© Thomas Mailund 2019
Thomas MailundThe Joys of Hashinghttps://doi.org/10.1007/978-1-4842-4066-3_7

7. Universal Hashing

Thomas Mailund1 
(1)
Aarhus N, Denmark
 

Generally, you cannot assume that your application can produce uniformly distributed keys; the hash functions in Chapter 6 are only heuristics. They make no guarantees about the results of hashing application keys and thus risk pathological cases where operations are linear rather than constant.

Since you cannot make assumptions about your hash keys, there is another technique you can employ: randomizing the hash functions. Instead of using a fixed hash function that might be sensitive to pathological keys, you can use a family of functions and sample from it. You can rely on random functions ...

Get The Joys of Hashing: Hash Table Programming with C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.