What is the search complexity in direct addressing?

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

What is the search complexity in direct addressing?
 
(a) O(n)
 
(b) O(logn)
 
(c) O(nlogn)
 
(d) O(1)
 
This interesting question is from Direct Addressing Tables in chapter Hash Tables of Data Structures & Algorithms I
 
I had been asked this question in examination.

1 Answers
Editor">Editor Staff answered 4 weeks ago

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