What is the search complexity in direct addressing?

Category: QuestionsWhat is the search complexity in direct addressing?
Editor">Editor Staff asked 1 month ago

What is the search complexity in direct addressing?
 
(a) O(n)
 
(b) O(logn)
 
(c) O(nlogn)
 
(d) O(1)
 
Asked question is from Hash Tables in division Hash Tables of Data Structures & Algorithms I
 
This question was addressed to me in a national level competition.

1 Answers
Editor">Editor Staff answered 1 month ago

Correct option is (d) O(1)
 
The explanation is: Since every key has a unique array position, searching takes a constant time.