1.

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 II have been asked this question in an international level competition.

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.



Discussion

No Comment Found

Related InterviewSolutions