Say you want to search the list to see if the value 13 is in the list using the binary search algorithm described here .
Which of the following values in the list (not the indices) will never be a value of "first" in the search for 13?
Hint
: If you get stuck, try running the code from the binary search page and add a few useful print statements to keep track of the value of the array at index "first."
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Below is a table describing the search space of the list and the middle element at each iteration of the while loop.
We can see that initially, first was 0 , then 1 0 , and finally 1 4 . 9 is a middle element at the intial step, but never a value of first.