所以我有一个函数,它可以在如下所示的大型未排序数字数组中找到一个大于 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