1.

In which of the following case jump search performs better than interpolation search?(a) When array has uniformly distributed values but is not sorted(b) when array is sorted and has uniform distribution of values(c) when array is sorted but the values increases exponentially(d) when array is not sortedI have been asked this question in homework.My question is based upon Searching in section Searching of Data Structures & Algorithms II

Answer»

Correct option is (c) when array is sorted but the values increases exponentially

The explanation is: In case of NON uniform distribution of values the time COMPLEXITY of INTERPOLATION search is O(n) whereas the average time complexity of jump search is O(n^1/2). So in such a case jump search has a better performance.



Discussion

No Comment Found

Related InterviewSolutions