28.6. Perfect Hashing¶
28.6.1. Perfect Hashing¶
Perfect hashing is a technique for storing records in a hash table in a way that guarentees no collisions. Perfect hashing sort of turns the concept of hashing on its head, in that it requires that the full set of keys to be stored be available in advance, and a hash function is then generated for that key set. Besides guarenteeing no collisions, perfect hashing techniques can store n records in a table with only n slots.
In this example, the set of keys is has already been selected to be the letters a to o. To see this in action, select "perfect hashing" as the hash method, select any collision resolution method, and select a hash table of size 15.