AlgoScope

Binary Search (recursive view)

Each call probes the middle and recurses into the half that can still hold the target. Depth O(log n).

Divide and conquer, algorithm, beginner
16 is below 72, so the answer can only be to the right: search 5 to 9.active 0-9205182123164235386567728919lowmidhigh16 < 72
16 is below 72, so the answer can only be to the right: search 5 to 9.active 0-9205182123164235386567728919lowmidhigh16 < 72

Search Variants: Binary search as a call stack

Decision, step 3 of 8

16 is below 72, so the answer can only be to the right: search 5 to 9. That is a new call on top of this one.

How search variants works

Cost

Best
O(1)
Average
O(log n)
Worst
O(log n)
Space
O(log n)

A variant of

Taught by the same lesson

Search Variants covers these too, in the same run.