Computer Science, asked by ayshaaalbloushi, 9 months ago


An interpolation search assumes that the data us an array is sorted and uniformly distributed. Whereas a binary search always looks at the middle item in an array, an interpolation search looks where the sought-for item is more likely to occur.

For example, if you search your telephone book (names are stored by last name then first name) for Yousef Alshamsi you will probably would look near its beginning rather than its middle. And if you discovered many Al-Shamsi(s) you would look near the last Alshamsi(s).

Now consider an array A of integers, instead of looking at the element A[mid] of the array, as the binary search would, an interpolation search examines A[index], where

P=(desiredElement- A[first])/(A[last]-A[First])
Index=first+[(Last-first) x p].

a. Implement the Interpolation search algorithm
b. For particular arrays, compare the outcome of an interpolation search and of a binary search. Consider arrays that have uniformly distributed entries and arrays that do not.

Answers

Answered by vvaruneshwaran2009
0

Answer:

i don't no it vduwsvhj edhvsahe svhd

Explanation:

Similar questions