Interpolation search PROBLEM
Given an ascending sequence of values A.1,...,A.N and target value V. Search routine should return an index of V in A. if V is present in the array, and N+1 otherwise.
ALGORITHM We assume that the keys are numerical and they are in the array uniformly distributed. On average interpolation search will take about lglgN comparisons.
IMPLEMENTATION
Unit: internal function
Global variables: ascending sequence of numerical values A.1,...,A.N Parameters: positive integer N, numerical value V Returns: the index of V in A. if V is present in the array, and N+1 otherwise
CONNECTIONS
Sequential search
Sequential search without sentinel Binary search Search in associative arrays Search an array of abscissas
Literature Sedgewick R. Algorithms Addison-Wesley, Reading, Massachusetts, 1984
|
|
|
|
|
|
![]()