0 votes
in Data Structures & Algorithms II by (110k points)
What is the time complexity of exponential search when the input array is sorted but the values are not uniformly distributed?

(a) O(n^1/2)

(b) O(log log n)

(c) O(n)

(d) O(log n)

The question was asked in semester exam.

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

1 Answer

+1 vote
by (614k points)
selected by
Best answer
The correct choice is (c) O(n)

To explain: When an array has non uniformly distributed values then in that case the algorithm of interpolation search fails to work efficiently. As a result, it has a time complexity of O(n) in such a case.

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.