Searchingintro
Binary Search
On sorted data, repeatedly probes the middle of the active window and discards the half that cannot contain the target. Each comparison halves the search space, giving logarithmic time.
- Best
- O(1)
- Average
- O(log n)
- Worst
- O(log n)
- Space
- O(1)