Exam-style question
Try this first
What is the time complexity of binary search?.
- A.O(1)
- B.O(log n)
- C.O(n)
- D.O(n²)
Model answer
What a good answer should say
- O(log n)
Explanation
Why this works
Binary search repeatedly halves the part of the list that still needs to be searched, giving a time complexity of O(log n).
Common mistake
No common mistake is linked to this question yet.
