Interpolation Search
Probe where a straight line through the range ends would put the target; log log n on even data.
Decision · step 3 of 4Search Variants: Interpolation on even data
90 equals 90: found at index 8.
What you will see
The probe lands near where the value "should" be instead of the middle.
Cost
| Best | O(1) |
|---|---|
| Average | O(log log n) |
| Worst | O(n) |
| Space | O(1) |
Average case assumes uniformly distributed keys.
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.