Probability of No Hash Collisions
Coding
Hashing
Medium
Hint 1
Assign buckets to keys one at a time and track how many buckets remain unused.
Hint 2
Multiply the probabilities that each successive key avoids all previously used buckets.
Show worked solution
1. Assign buckets sequentially
The first key can go anywhere. The second must avoid 1 used bucket (probability ), the third must avoid 2 used buckets (probability ), and so on down to the tenth key avoiding 9 used buckets (probability ).
2. Multiply the probabilities
The overall probability is the product of these ten factors.
Answer: (100*99*...*91)/100^10
Related roles: Browse quant jobs