Interpolation search vs Binary search

2

Interpolation search works better than Binary Search for a sorted and uniformly distributed array.

On average the interpolation search makes about log(log(n)) comparisons (if the elements are uniformly distributed), where n is the number of elements to be searched. In the worst case (for instance where the numerical values of the keys increase exponentially) it can make up to O(n) comparisons.

Interpolation Search Article

Sources:
http://en.wikipedia.org/wiki/Interpolation_search

GATE CS Corner    Company Wise Coding Practice

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

Recommended Posts:



2 Average Difficulty : 2/5.0
Based on 48 vote(s)










Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.