不明白應該怎樣寫,請各位高手教下我,thx
int[] array = { 5, 9, 12, 34, 36, 46, 48, 50, 55, 65, 77, 89, 102 };
int index;
// perform binary search
index = binarySearch( array, 99);
System.out.println(index);
用上面資料寫到輸出會變成這樣
will be looked as:
50 55 65 77 89 102
77 89 102
102
-1
int[] array = { 5, 9, 12, 34, 36, 46, 48, 50, 55, 65, 77, 89, 102 };
int index;
// perform binary search
index = binarySearch( array, 99);
System.out.println(index);
用上面資料寫到輸出會變成這樣
will be looked as:
50 55 65 77 89 102
77 89 102
102
-1