@MISC{Sanders02alecture, author = {Peter Sanders}, title = {A Lecture on Cuckoo Hashing}, year = {2002} }

Share

OpenURL

Abstract

has been intensive research into finding perfect hash functions. The idea is to start with a pseudo-random hash function and than to patch it based on the particular set of elements stored so that it becomes perfect. Unfortunately this is somewhat complicated in particular if the set of elements stored changes dynamically under insertions and deletions. Therefore we will present a different approach due to Pagh and Rodler [3] that does not need perfect hash functions and yet requires only O(n) space. We use two random hash functions h 1 and h 2 and two tables t 1 and t 2 of size N = n=ff for some constant ff ! 1. We only require that x is stored either in t 1 [h 1 (x)] or in t 2 [h 2 (x)]. Searching in worst case 1 3,12,... 4,13,... 9,18,... 1,6,10,15... 2,5,11,14,... 7,16,... 8,17,... Figure 1: Example where cuckoo hashing runs into an infinite loop. constant time is easy then. Deletion is also easy. Just check the two possible places where an element is stored. However, ins