AlgoViz

Interpolation Search

Interpolation Search estimates the position of the target using interpolation formula, performing better than binary search for uniformly distributed data.

IntermediateTime: O(log log n)Space: O(1)
64
34
25
12
22
11
90
45
67
33
Speed1x

Current Step

Press Play to start the visualization


## How Interpolation Search Works

Interpolation Search is an improved variant of binary search for uniformly distributed sorted arrays. It estimates the position of the target using interpolation formula.

### Algorithm Steps:
1. Calculate position using: pos = low + ((target - arr[low]) × (high - low)) / (arr[high] - arr[low])
2. If arr[pos] equals target, return pos
3. If arr[pos] < target, search in right half
4. If arr[pos] > target, search in left half
5. Repeat until found or interval is empty

### Key Characteristics:
- **Requires sorted array**: Must be sorted
- **Best for uniform distribution**: O(log log n) for uniformly distributed data
- **Estimates position**: Uses value to guess location
- **Degrades for non-uniform data**: Can be O(n) in worst case

Time & Space Complexity

CaseTime Complexity
BestO(1)
AverageO(log log n)
WorstO(n)
SpaceO(1)

Practice Problems

No Problems Available

Practice problems for this algorithm are coming soon!