Question 1Hide question4 indicative marks
A sorted list contains 1024 distinct items. Explain binary search and give the worst-case number of midpoint comparisons to find an item or establish it is absent.
Cambridge 2027: Partial conceptual match
Binary-search precondition and logarithmic comparison count are evidenced; this explanation does not implement either search or establish all time/space comparisons.
- 9618: 19.1 Algorithms / Candidates should be able to / objective row 1: Implement linear/binary search; binary-search preconditions and scaling
- 9618: 19.1 Algorithms / Candidates should be able to / objective row 5: Compare algorithm time/space using Big O
Conceptual placement only, not official Cambridge endorsement or complete syllabus coverage.
Show indicative guidance
Worked guidance
- Each midpoint comparison roughly halves the remaining search interval, including the possibility of a final single item.
- Compare the target with the middle item.
- Discard the half that cannot contain it, repeating until found or the interval is empty.
- Worst case is 11 midpoint comparisons for 1024 items.
- The time complexity is O(log n); the list must be sorted.
Self-marking points
Tick what your working earned. The count is your own self-assessment.
Self-assessed: not counted yet. This question is worth 4 marks.
Examiner tip
1024 = does not imply a worst case of ten midpoint comparisons: the final item can require an eleventh.