GATE Computer ScienceHardGATE CS (PYQ pattern)

Twenty keys are hashed into a chained table with 8 slots, each key independently and uniformly. What are the expected number of colliding pairs (unordered pairs of keys landing in the same slot) and the expected number of empty slots?

  1. A. 23.75 and about 0.55
  2. B. 25.00 and about 0.55
  3. C. 23.75 and about 5.50
  4. D. 2.50 and about 0.55

Correct answer: A. 23.75 and about 0.55

Each of the C(20,2) = 190 pairs collides with probability 1/8, so by linearity the expected number of colliding pairs is 190/8 = 23.75. A given slot stays empty with probability (7/8)^20, so the expected number of empty slots is 8 * (7/8)^20 = 0.55. Using 20^2/2 pairs, or treating the load 2.5 as a count, are the usual slips.

More Programming and Data Structures (GATE) questions

Exams that ask this topic