11-2 Slot-size bound for chaining

Suppose that we have a hash table with nn slots, with collisions resolved by chaining, and suppose that nn keys are inserted into the table. Each key is equally likely to be hashed to each slot. Let MM 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)O(\lg n / \lg\lg n) upper bound on E[M]\text E[M], the expected value of MM.

a. Argue that the probability QkQ_k that exactly kk keys hash to a particular slot is given by

Qk=(1n)k(11n)nk(nk).Q_k = \bigg(\frac{1}{n} \bigg)^k \bigg(1 - \frac{1}{n} \bigg)^{n - k} \binom{n}{k}.

b. Let PkP_k be the probability that M=kM = k, that is, the probability that the slot containing the most keys contains kk keys. Show that PknQkP_k \le n Q_k.

c. Use Stirling's approximation, equation (3.18)\text{(3.18)}, to show that Qk<ek/kkQ_k < e^k / k^k.

d. Show that there exists a constant c>1c > 1 such that Qk0<1/n3Q_{k_0} < 1 / n^3 for k0=clgn/lglgnk_0 = c\lg n / \lg\lg n. Conclude that Pk<1/n2P_k < 1 / n^2 for kk0=clgn/lglgnk \ge k_0 = c\lg n / \lg\lg n.

e. Argue that

E[M]Pr{M>clgnlglgn}n+Pr{Mclgnlglgn}clgnlglgn.\text E[M] \le \Pr\bigg\{M > \frac{c\lg n}{\lg\lg n}\bigg\} \cdot n + \Pr\bigg\{M \le \frac{c\lg n}{\lg\lg n}\bigg\} \cdot \frac{c\lg n}{\lg\lg n}.

Conclude that E[M]=O(lgn/lglgn)\text E[M] = O(\lg n / \lg\lg n).

(Removed)