小编tam*_*jar的帖子

如何编写一个函数来并行查找大于 N 的值

所以我有一个函数,它可以在如下所示的大型未排序数字数组中找到一个大于 N 的数字。

import java.util.*;

public class program {

    // Linear-search function to find the index of an element
    public static int findIndex(int arr[], int t)
    {
        // if array is Null
        if (arr == null) {
            return -1;
        }

        // find length of array
        int len = arr.length;
        int i = 0;

        // traverse in the array
        while (i < len) {

            // if the i-th element is t
            // then return the index
            if (arr[i] > t) { …
Run Code Online (Sandbox Code Playgroud)

java parallel-processing performance multithreading multiprocessing

5
推荐指数
0
解决办法
211
查看次数