Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 : A variant of binary search algorithm is called interpolation search. Similar to the binary search algorithm, it works on a sorted array

Question 2: A variant of binary search algorithm is called interpolation search. Similar to the
binary search algorithm, it works on a sorted array of elements by dividing it into two subarrays
and compare a search key with an element at which the sorted array was divided. However, unlike
the binary search algorithm, the interpolation search algorithm does not divide the sorted array
into two even subarrays. It, instead, uses the values of the search key to decide at which arrays
element the sorted array should be divided into two uneven subarrays and then compare the
search key with that element. More formally, instead of calculating the midpoint element of the
sorted array, in the binary search algorithm, as +2, the interpolation search
estimates the position of the arrays element at which the sorted array should be divided as +
([[]])([])
(a) Based on the above description of the interpolation search algorithm, write down its
pseudocode.
(b) Under which algorithms design paradigm would you classify the interpolation search
algorithm? Justify your answer.
(c) Give characterizations of the worst-case input for the interpolation search and show through
example that the algorithm is linear (n) in the worst-case.
(d) Give characterizations of the best-case input for the interpolation search and show through
example that the algorithm is log log n in the best-case.
(e) For the application of Phone Book, contacts are arranged in sorted order and nearly uniform.
If you were asked to recommend one of the two algorithms (binary search and interpolation
search), which one would you recommend and why

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

what is a peer Group? Importance?

Answered: 1 week ago

Question

I am paid fairly for the work I do.

Answered: 1 week ago

Question

I receive the training I need to do my job well.

Answered: 1 week ago