Probability, Statistics and Queueing
Ten keys are stored in a hash table with 100 buckets. Each key is assigned independently to one of the 100 buckets with equal probability. Which of the following is the expected number of pairs of keys that are assigned to the same bucket?
- A0.1
- B0.45
- C0.9
Show answer and explanation
Answer: B. 0.45
There are 10C2 = 45 pairs of keys, and each pair lands in the same bucket with probability 1/100. By the linearity of expectation (the expected value of a sum is the sum of the expected values), the expected number of pairs in the same bucket is 45 × 1/100 = 0.45. Linearity of expectation holds even when the pairs are not independent, so the probabilities of the pairs can simply be added.
- A. This divides the number of keys, 10, by 100 and does not count the pairs of keys.
- B. Correct. 10C2 ÷ 100 = 45 ÷ 100 = 0.45.
- C. 10 × 9 = 90 is the number of ordered pairs, which counts each pair twice.
Continue: 9 more Probability, Statistics and Queueing questions