UGC-NET Jun 2014 · File Organization & Data Types

MCQ · 2 marks · Problem DBMS-INDX-0006

Searching for an element in the hash table requires $O(1)$ time for the time, whereas for direct addressing it holds for the time.
  1. A
    worst-case, average
  2. B
    worst-case, worst-case
  3. C
    average, worst-case
  4. D
    best, average

Solve it on GATE DA practice →More Storage & Indexing problems

Show the worked solutionWith chaining and simple uniform hashing, a search costs \(\Theta(1+\alpha)\) on average, which is \(O(1)\) when the load factor \(\alpha=n/m\) is constant. In the worst case all keys hash to one slot and a search costs \(\Theta(n)\). A direct-address table indexes slot \(k\) directly, so every search is \(O(1)\) even in the worst case.Answer: C

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com