mid = low + (((high - 1) * (x - A[low])) / (A[high] - A[low]));
21 returnmid;
// Found x, return (exit) 23high = mid - 1;
// X lies before mid 25low = mid + 1;
// x lies after mid 33 intA[] = {2, 4, 5, 7, 13, 14, 15, 23};
39std::cout <<
"Number "<< x <<
" not found"<< std::endl;
41std::cout <<
"Number "<< x <<
" is at "<< index << std::endl;
44// randomly set x bcoz array was defined by us , therefore not reasonable for 45// asking input. We could have asked for input if array elements were inputed byint InterpolationSearch(int A[], int n, int x)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4