Jump Search vs Interpolation Search
Across our 4 test inputs, Interpolation Search needed 6 comparisons in total versus 21 for Jump Search. On average Jump Search runs in O(√n) time and Interpolation Search in O(log log n).
Head-to-head on identical inputs (comparisons)
| Input | Jump Search | Interpolation Search |
|---|---|---|
| Target is first | 2 | 1 |
| Target in the middle | 4 | 2 |
| Target is last | 8 | 1 |
| Target absent | 7 | 2 |
Complexity
| Jump Search | Interpolation Search | |
|---|---|---|
| Average time | O(√n) | O(log log n) |
| Worst time | O(√n) | O(n) |
| Space | O(1) | O(1) |
| Stable | No | No |
When to use Jump Search
Sorted data where jumping backwards is expensive (e.g. linked storage or tape-like media).
When to use Interpolation Search
Large sorted arrays whose values are roughly uniformly distributed (IDs, timestamps).