Exam-style question
Try this first
Explain why the time complexity of binary tree search is O(log n). In your answer, describe what happens to the search after each comparison and relate this to the number of levels that may need to be examined.
Answer and explanation
Concise answer
Binary tree search compares the target with the current node and then follows only one of the two branches.
Why this is correct
The essential points are that a comparison selects one branch, the search does not examine both branches at every step, and the resulting number of levels is logarithmic in the number of values. These points justify O(log n).
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.
