Exponential Search
Double the probe index until the value passes the target, then binary search the last doubling: O(log i).
Decision · step 2 of 9Search Variants: Doubling to a target near the front
Index 1 holds 3, below 9: double the bound to 2.
What you will see
Probes at 1, 2, 4, 8, ...; then a binary search inside the last doubling.
Cost
| Best | O(1) |
|---|---|
| Average | O(log i) |
| Worst | O(log i) |
| Space | O(1) |
i is the target's position.
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.
Screen readers: Cells announce index, value and state (current, discarded, found); each step announces the comparison and the resulting range.
Reduced motion: Range and pointer changes snap into place with a short crossfade; discarded cells fade without movement.
Before this
Related
Taught by the same lesson
Search Variants covers these too, in the same run.