+1 vote
in Data Structures & Algorithms I by (88.2k points)
In simple uniform hashing, what is the search complexity?

(a) O(n)

(b) O(logn)

(c) O(nlogn)

(d) O(1)

My question is from Hash Tables in division Hash Tables of Data Structures & Algorithms I

I have been asked this question in an international level competition.

1 Answer

+1 vote
by (672k points)
selected by
Best answer
The correct answer is (d) O(1)

For explanation: There are two cases, once when the search is successful and when it is unsuccessful, but in both the cases, the complexity is O(1+alpha) where 1 is to compute the hash function and alpha is the load factor.

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.