Suppose the following array has been declared:
// index 0 1 2 3 4 5 6 7 8 9
int[] list = {–2, 8, 13, 22, 25, 25, 38, 42, 51, 103};
What indexes will be examined as the middle element by a binary search for each of the following target values?
What value will be returned?
a. 103
b. 30
c. 8
d. –1
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.