Mathematical Guarantees
For any fixed set of keys, using a universal family guarantees the following properties.
- For any fixed in, the expected number of keys in the bin is . When implementing hash tables by chaining, this number is proportional to the expected running time of an operation involving the key (for example a query, insertion or deletion).
- The expected number of pairs of keys in with that collide is bounded above by, which is of order . When the number of bins, is, the expected number of collisions is . When hashing into bins, there are no collisions at all with probability at least a half.
- The expected number of keys in bins with at least keys in them is bounded above by . Thus, if the capacity of each bin is capped to three times the average size, the total number of keys in overflowing bins is at most . This only holds with a hash family whose collision probability is bounded above by . If a weaker definition is used, bounding it by, this result is no longer true.
As the above guarantees hold for any fixed set, they hold if the data set is chosen by an adversary. However, the adversary has to make this choice before (or independent of) the algorithm's random choice of a hash function. If the adversary can observe the random choice of the algorithm, randomness serves no purpose, and the situation is the same as deterministic hashing.
The second and third guarantee are typically used in conjunction with rehashing. For instance, a randomized algorithm may be prepared to handle some number of collisions. If it observes too many collisions, it chooses another random from the family and repeats. Universality guarantees that the number of repetitions is a geometric random variable.
Read more about this topic: Universal Hashing
Famous quotes containing the words mathematical and/or guarantees:
“It is by a mathematical point only that we are wise, as the sailor or the fugitive slave keeps the polestar in his eye; but that is sufficient guidance for all our life. We may not arrive at our port within a calculable period, but we would preserve the true course.”
—Henry David Thoreau (18171862)
“... if a person is to be unconventional, he must be amusing or he is intolerable: for, in the nature of the case, he guarantees you nothing but amusement. He does not guarantee you any of the little amenities by which society has assured itself that, if it must go to sleep, it will at least sleep in a comfortable chair.”
—Katharine Fullerton Gerould (18791944)