Skip to main contentSkip to solution

If every item of the list maps to a unique index in the hash table, the hash function is called ________.

Solution

✅ Correct Option: 1

A perfect hash function maps every item in the set to a unique index in the hash table, so no two items collide and every lookup takes constant time.


Option 2: a universal hash function is a randomly chosen function from a family, designed so that the expected number of collisions is low. It does not guarantee zero collisions.

Option 3: a collision is the event where two keys map to the same index. It is not a type of hash function.

A minimal perfect hash function goes one step further. It maps nn items to exactly nn slots with no empty slots.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question