Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Perfect hashing in CLRS relies on universal hashing functions. How can the full

ID: 3761697 • Letter: P

Question

Perfect hashing in CLRS relies on universal hashing functions. How can the full strength be relaxed, so that it can have the weaker condition prob(h(x) = h(y)) = O(1/n)? where x!=y? Explain

Explanation / Answer

Definition: H is a 2-universal family (set) of hash functions from M to N if: for all x,y in M (x != y), Prob[h(x) = h(y)] given this value of a, we must have b = r-ax (mod p). So, this probability is 1/[p(p-1)]. (What is the probability for r=s? Ans: 0) Now, how many pairs r!=s are there in {0,...,p-1} such that r = s (mod n)? -> have p choices for r, and then at most ceiling(p/n)-1 choices for s ("-1" since we disallow s=r). The product is at most p(p-1)/n Putting this all together, Pr[(a*x + b mod p) mod n = (a*y + b mod p) mod n] Perfect hashing. (h is perfect for S if it causes no collisions). 1 way: Say O(|S|^2) space is OK. Then, just do a universal hash function into table of size n=|S|^2. For any x!=y, we have Pr[h(x)=h(y)]
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote