GATE / CS ARCHIVE

GATE CSE 1997 / QUESTION 12(a)

Probability a bucket remains empty

Discrete Mathematics · Probability & Random Variables · Full GATE CSE 1997 paper

GATE 1997, Q12(a) 1 mark · Descriptive
Report issue

Probability & Random Variables

Question 12(a), GATE 1997: A hash table has n≥1 buckets, uses external chaining, and is initially empty. K distinct keys are inserted. Each key hashes uniformly to one of the n buckets. Under the standard additional assumption that different keys hash independently, find the probability that bucket 1 is empty after K insertions.
Question 12(a), GATE 1997: A hash table has n≥1 buckets, uses external chaining, and is initially empty. K distinct keys are inserted. Each key hashes uniformly to one of the n buckets. Under the standard additional assumption that different keys hash independently, find the probability that bucket 1 is empty after K insertions.
Tap to enlarge
Answer & solution

Answer: ((n−1)/n)^K, for independent uniform hashing. (no official key was published)

A single inserted key avoids bucket 1 with probability (n−1)/n=1−1/n. Bucket 1 is empty after K insertions exactly when every one of those K keys avoids it. Under independent hashing, multiply the K probabilities to obtain

P(bucket 1 empty) = (1−1/n)K.

The table may have collisions in other buckets; they do not affect this event. External chaining allows arbitrarily many keys in a bucket, so K need not be at most n. For K=0 the probability is 1, including the n=1 case, by the empty-product convention. For n=1 and K≥1 it is 0, because the only bucket must receive every key. For n=2,K=3 it is (1/2)3=1/8.

The independence qualification is substantive. The source supplies the uniform probability for any individual key, but marginal uniformity alone is not enough to multiply events. For example, choose one uniformly random bucket U and send all keys to U. Every key is marginally uniform, yet bucket 1 remains empty with probability 1−1/n for every K≥1, rather than (1−1/n)K. The displayed answer uses the usual independent-uniform hashing model and is not claimed under that correlated alternative.

Original paper, page 7