Exam-style question
Try this first
Explain why binary search has a time complexity of O(log n). In your answer, describe what happens to the remaining search range after each comparison.
Answer and explanation
Concise answer
At each comparison, binary search checks the middle item of the current range.
Why this is correct
The key feature is repeated halving. The algorithm does not examine every item in turn; each comparison substantially reduces the number of possible positions that still need to be checked.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
