320 likes | 1.14k Views
Interpolation search:. Interpolation search parallels how humans search through a telephone book. Instead of comparing against every item like the linear search , it attempts to find the item by approximating how far the item is likely to be from the current position. Algo.
E N D
Interpolation search: Interpolation search parallels how humans search through a telephone book. Instead of comparing against every item like the linear search, it attempts to find the item by approximating how far the item is likely to be from the current position
Algo Function location(low,high) if low<=high mid =low+(((x-s[low](high-low))/s(high)-s(low)) if x=s[mid] return mid else if x<s[mid] location=location(low,mid-1) else location=location(mid+1,high)
Complexity of Algo For Average case: Average case: lg(lg(n)) For Worst case: worst Case: O(n)