How does Binary Search achieve O(log n)?
Updated Apr 28, 2026
Short answer
An intermediate dive into How does Binary Search achieve O(log n)?.
Deep explanation
Algorithms at this level often involve divide-and-conquer strategies or dynamic data structures. For example, O(log n) occurs when the problem size is halved at each step.
Real-world example
Using a phone book to find a name using the middle-split method.
Common mistakes
- Thinking all loops are O(n)
- some decrease the input size exponentially.
Follow-up questions
- Is O(n log n) better than O(n^2)?
- Does recursion always increase space complexity?