File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,23 @@ public static void main(String[] args) {
4545 * @param number
4646 * @return index of given number in array or -1 if not found
4747 */
48- public static int performBinarySearch (int [] input , int number ) {
48+ // public static int performBinarySearch(int[] input, int number) {
49+ // int low = 0;
50+ // int high = input.length - 1;
51+
52+ // while (high >= low) {
53+ // int middle = (low + high) / 2;
54+ // if (input[middle] == number) {
55+ // return middle;
56+ // } else if (input[middle] < number) {
57+ // low = middle + 1;
58+ // } else if (input[middle] > number) {
59+ // high = middle - 1;
60+ // }
61+ // }
62+ // return -1;
63+ // }
64+ public static int performBinarySearch (int [] input , int number ) {
4965 int low = 0 ;
5066 int high = input .length - 1 ;
5167
You can’t perform that action at this time.
0 commit comments