Probability of No Hash Collisions

Coding
Hashing
Medium
Ten keys are independently hashed uniformly into 100 buckets. What is the probability that no two collide?
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. 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. 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

Related problems