Consider a hash table with 100 slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first 3 slots are unfilled after the first 3 insertions?
GATE CSE 2014Data Structures › Hashing & Complexity AnalysisVerified
GATE CSE 2014 PYQ: Consider a hash table with 100 100 100 slots. Collisions are resolved using chaining. Assuming simple…
- ACorrect answer
- B
- C
- D
Answer
(A) ( 97 × 97 × 97 ) / 10 0 3 (97 \times 97 \times 97) / 100^3 ( 97 × 97 × 97 ) /10 0 3
Approach
The first 3 slots remain unfilled exactly when each of the 3 inserted keys hashes into one of the other 97 slots. Since hashing is uniform and independent across insertions, each insertion has probability 97/100 of avoiding the first 3 slots, so multiply this probability three times.
The first 3 slots are unfilled iff all 3 inserted elements hash to slots 4 through 100. Each insertion has probability 97/100 of doing so, independently. Hence the probability is $(97/100)^3 =$ (97 × 97 × $97)/100^3$, matching option A.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.