- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Universal Hashing in Data Structure
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 + α).