Consider binary search on a sorted array of numeric keys. The following options list possible sequences of key values that the algorithm might compare against the search target (in order of comparisons).
Assume the keys 180, 200, 450, and 500 are in the array and are ordered so that 180 < 200 < 450 < 500.
Which of the following cannot be a sequence of keys compared during a single run of binary search (for some target value) on some sorted array?
Options:
500, 200, 450, 180
500, 450, 200, 180
180, 500, 200, 450
180, 200, 500, 450
Login required