A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/df/d39/interpolation__search2_8cpp_source.html below:

TheAlgorithms/C++: search/interpolation_search2.cpp Source File

Go to the documentation of this file. 19 int

mid = low + (((high - 1) * (x - A[low])) / (A[high] - A[low]));

21 return

mid;

// Found x, return (exit) 23

high = mid - 1;

// X lies before mid 25

low = mid + 1;

// x lies after mid 33 int

A[] = {2, 4, 5, 7, 13, 14, 15, 23};

39

std::cout <<

"Number "

<< x <<

" not found"

<< std::endl;

41

std::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 by

int 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