A perfect hash function maps every input key to _____________ in the hash table.
A perfect hash function maps every input key to _____________ in the hash table.
Solution
✅ Correct Option: 2
A perfect hash function maps each distinct key to a different slot, so no two keys share an index. This means there are no collisions, and lookup takes constant time without needing chaining or probing.
Options 1 and 3: similar or duplicate indices are exactly what a collision is, which a perfect hash function avoids.
A minimal perfect hash function goes further: it maps keys onto exactly slots with no empty ones.
Related questions:
2026: 31 May Shift 1
2026: 18 May Shift 2
2026: 23 May Shift 2