A binary search is being used to find a target value in a sorted array. The target value is smaller than the value at the mid-point of the array.
Identify what the binary search does next.
Mark scheme
- D Discards the second half of the array (1)
- The only correct answer is D. The correct answer is discards the second half of the array.
- A is not correct because checking each item from the start of the array is how a linear search works, not a binary search
- B is not correct because the target value is smaller than the mid-point, so it must be in the first half, which is kept and searched again
- C is not correct because the mid-point has already been compared and is not the target, so it is discarded along with the second half
Example answers and how they were marked
D Discards the second half of the array
Why: Selects the correct option (1): the target is smaller than the mid-point, so the mid-point and the second half are discarded.
B Discards the first half of the array
Why: Discards the wrong half; the target is smaller than the mid-point, so the first half is the part that must be searched again.
A Checks each item from the start of the array
Why: Describes a linear search rather than a binary search, so no credit.