Searching
TimeO(log n)SpaceO(1)
On a sorted array, check the middle element and discard the half that can't contain the target — halving the search space every step.
Key idea. Halve the search space each step. Only works on sorted data — that precondition is what buys the logarithmic speed.
1
Loading…
—