perfect hash function
A hash function that sends every key in a known, fixed set to a different slot, so there are no collisions at all.
In more detail
With a perfect hash, every lookup is exactly one probe. It is only possible when all keys are known in advance, as for a language's reserved words. The course uses it as the ideal against which a constant hash, the opposite extreme, is compared.
Related terms
- hash function — A function that turns data of any size into a fixed-size value, called its hash, used to find items quickly in a table or to detect any change in the data.
- collision — Two different keys producing the same hash, or the same slot in a hash table.
Taught in
- What A Hash Function Promises — Algorithms & Data Structures for Working Engineers
- Collisions In Practice And Hash Flooding — Algorithms & Data Structures for Working Engineers