Efficient Evaluation of Minimal Perfect Hash Functions
Efficient Evaluation of Minimal Perfect Hash Functions
Efficient Evaluation of Minimal Perfect Hash Functions
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
1.2 The Tarjan-Yao Displacement SchemeThe class <strong>of</strong> hash functions presented here can be seen as a variation <strong>of</strong> an early perfect class <strong>of</strong>hash functions due to Tarjan and Yao [13]. Their class requires a universe <strong>of</strong> size u = O(n 2 )(which they improve to u = O(n c ) for constant c > 2). The idea is to split the universe into blocks<strong>of</strong> size O(n), each <strong>of</strong> which is assigned a “displacement” value. The ith element within the jth blockis mapped to i + d j , where d j is the displacement value <strong>of</strong> block j. Suitable displacement valuescan always be found, but in general displacement values (and thus hash table size) larger than nmay be required. A “harmonic decay” condition on the distribution <strong>of</strong> elements within the blocksensures that suitable displacement values in the range {0, . . . , n} can be found, and that they canin fact be found “greedily” in decreasing order <strong>of</strong> the number <strong>of</strong> elements within the blocks. Toachieve harmonic decay, Tarjan and Yao first perform a displacement “orthogonal” to the other.The central observation <strong>of</strong> this paper is that a reduction <strong>of</strong> the universe to size O(n 2 ), as well asharmonic decay, can be achieved using universal hash functions. Or equivalently, that buckets in a(universal) hash table can be resolved using displacements.ijdji+djFigure 1: Tarjan-Yao displacement scheme2 A <strong>Perfect</strong> Class <strong>of</strong> <strong>Hash</strong> <strong>Functions</strong>The concept <strong>of</strong> universality [1] plays an important role in the analysis <strong>of</strong> our class. We use thefollowing notation.Definition 1 A class <strong>of</strong> functions H r = {h 1 , . . . , h k }, h i : U → {0, . . . , r − 1}, is c-universal if forany x, y ∈ U, x ≠ y,Pri[h i (x) = h i (y)] ≤ c/r .It is (c, 2)-universal if for any x, y ∈ U, x ≠ y, and p, q ∈ {0, . . . , r − 1},Pri[h i (x) = p and h i (y) = q] ≤ c/r 2 .Many such classes with constant c are known, see e.g. [4]. For our application the important thing tonote is that there are universal classes that allow efficient storage and evaluation <strong>of</strong> their functions.More specifically, O(log u) (and even O(log n + log log u)) bits <strong>of</strong> storage suffice, and a constantnumber <strong>of</strong> simple arithmetic and bit operations are enough to evaluate the functions. Furthermore,3