+1 vote
in Data Structures & Algorithms II by (110k points)
What are the updated values of high and low in the array if the element being searched is greater than the value at calculated index in interpolation search? (pos = current position)

(a) low = pos + 1, high remains unchanged

(b) high = pos – 1, low remains unchanged

(c) low = low +1, high = high – 1

(d) low = pos +1, high = pos – 1

I have been asked this question by my college director while I was bunking the class.

This question is from Searching in portion Searching of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
 
Best answer
Correct answer is (a) low = pos + 1, high remains unchanged

The best I can explain: When the element being searched is greater than the value at the calculated position then in that case we update low and high remains unaltered. Updated value of low is low = pos + 1.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...