11-2 Slot-size bound for chaining
Suppose that we have a hash table with n slots, with collisions resolved by chaining, and suppose that n keys are inserted into the table. Each key is equally likely to be hashed to each slot. Let M be the maximum number of keys in any slot after all the keys have been inserted. Your mission is to prove an O(lgn/lglgn) upper bound on E[M], the expected value of M.
a. Argue that the probability Qk that exactly k keys hash to a particular slot is given by
Qk=(n1)k(1−n1)n−k(kn).
b. Let Pk be the probability that M=k, that is, the probability that the slot containing the most keys contains k keys. Show that Pk≤nQk.
c. Use Stirling's approximation, equation (3.18), to show that Qk<ek/kk.
d. Show that there exists a constant c>1 such that Qk0<1/n3 for k0=clgn/lglgn. Conclude that Pk<1/n2 for k≥k0=clgn/lglgn.
e. Argue that
E[M]≤Pr{M>lglgnclgn}⋅n+Pr{M≤lglgnclgn}⋅lglgnclgn.
Conclude that E[M]=O(lgn/lglgn).
(Removed)