Quantcast
Channel: what is the expected number of collisions? - Mathematics Stack Exchange
Viewing all articles
Browse latest Browse all 5

what is the expected number of collisions?

$
0
0

Suppose we use a hash function $H$ to hash $N$ distinct balls into $M$ distinct bins. Assuming simple uniform hashing, what is the expected number of collisions?

Note that a collision is defined by adding a ball to an already occupied bin. If the already occupied bin has $k$ balls in it, then the number of collisions upon adding a new ball is $k.$


By using expectation, I tried as :

=> 1 × Probability of collision in first insertion +

2 × Probability of collision in second insertion + .......... +

n × Probability of collision in nth insertion

=> $(1 ∗ 0) + (2 ∗ 1/m) + (3 ∗ 2/m) + (4 ∗ 3/m) +…+ (n ∗ n−1/m)$


Actually, The answer is $(n^2 - n)/2m$


But, I am not getting the answer. Where am I wrong here ?


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images