Explain in your own words why binary search runs in O(log n) time.
Think about your answer, then reveal below.
Model answer: Binary search halves the search space at each step. Starting with n elements, after one comparison you have n/2 remaining; after two, n/4; and so on. The number of steps needed to reduce n to 1 is log₂(n), because you are asking 'how many times can I halve n before reaching 1?' — which is the definition of the base-2 logarithm.
The halving argument is the key intuition. Any algorithm that discards a constant fraction of its remaining work at each step will have logarithmic complexity. This is why binary search, balanced BST operations, and many divide-and-conquer algorithms share the O(log n) signature — they all reduce the problem size multiplicatively rather than additively.