Question: Use the recursive method binarySearch given below and an array a given as an image below, to complete the following question: Suppose I make
Use the recursive method binarySearch given below and an array a given as an image below, to complete the following question: Suppose I make a method call: binarySearch(a, 96, 0, a.length - 1);. How many recursive binarySearch calls are made before returning? Note: Don't include the first method call: binarySearch(a, 96, 0, a.length - 1); as part of your count. Method: public int binarySearch (int[] n, int key, int lo, int hi) { if (lo >hi) { return -1; } int mid if (keya[mid]) { } = lo (hilo) / 2; return binarySearch (a, key, lo, mid 1); - else if (key > a[mid]) { return binarySearch(a, key, mid + 1, hi); } else { return mid; } } a (array): 6 13 14 25 33 43 51 53 64 72 84 93 95 96 97 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Type your answer...
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
