Interpolation Search
Assumes values are uniformly distributed and estimates the target's position by proportional interpolation. Faster than binary search on uniform data, but it can degrade to O(n) in the worst case on skewed distributions.
01Interpolation Search
Explore How It WorksStarting interpolation search. Assuming the values are evenly spread, a proportion points straight at where the target should be.
Within the span from 5 to 98, 45 lies toward the front. The proportion points at index 3 — closer to the target than the midpoint binary search would pick.
The value there is 34, below 45. The target is to the right, so recompute from just past it.
This time the first value of the remaining range is the target itself, so the proportion lands exactly on it.
The probed slot holds 45 — found in just two comparisons.
Search complete · 45 sits at index 4. Strong on evenly spread data, but degrades to O(n) when the values are skewed.
02 Understand It Simply
For EveryoneAssumes the values are evenly distributed and estimates the target's position proportionally. When the assumption holds it beats binary search.
Assumes an even distribution and estimates the target's position proportionally to skip ahead.
Faster than binary search on uniform data.
- –Uniformly distributed sorted data (phone books
- –etc.)
03 Python Implementation
A clean, readable reference implementation of the core logic of Interpolation Search.
04 Frequently Asked Questions
FAQWhat is Interpolation Search?+
Assumes values are uniformly distributed and estimates the target's position by proportional interpolation. Faster than binary search on uniform data, but it can degrade to O(n) in the worst case on skewed distributions.
What is the time complexity of Interpolation Search?+
The time complexity of Interpolation Search is O(log log n) avg. Follow the step-by-step visualization to see exactly why.
Where is Interpolation Search used?+
Uniformly distributed sorted data (phone books, etc.).
What's a simple analogy for Interpolation Search?+
Assumes the values are evenly distributed and estimates the target's position proportionally. When the assumption holds it beats binary search.
