Binary search
Find a target in sorted data by repeatedly halving the remaining search range.
Remember: Sorted → middle → discard half.
Example: [2,5,8,12], target 8 → index 2.
Time: O(log n). Auxiliary space: O(1).
Formula: mid = low + floor((high − low) / 2)
Ascending input is required. Search uses inclusive low/high; −1 means absent.
Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.
The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.