Universal Hashing in Data Structure

Data StructureAnalysis of AlgorithmsAlgorithms

For any hash function we can say that if the table size m is much smaller than universe size u, then for any hash function h, there is some large subset of U that has the same hash value.

To get rid of this problem, we need a set of hash functions, from which we can choose any one that works well for S. If most of the hash functions are better for S, we can choose random hash function

Suppose ℌ be a set of hash functions. We can say ℌ is universal if, for each x, y ∈ U, the number of h ∈ ℌ, such that h(x) = h(y) is at most |ℌ|/𝑚. In other words we can say that with a hash function h, which is randomly chosen from ℌ, the chance of a collision between distinct keys x and y, is no more than the chance 1/m. of a collision if h(x) = h(y), were randomly and independent chosen from the set {0, 1, . . ., m – 1}.

If we store S in a hash table using the hash function h, then the expected time for searching and deleting is O(1 + α).

Published on 10-Aug-2020 12:55:12