GATE | GATE CS 1997 | Question 56
What is the probability of a collision when hashing n keys into a hash table of size m, assuming that the hash function produces a uniform random distribution?
(A)
O(1/n)
(B)
O(n/m)
(C)
O(logn)
(D)
O(m/n)
Answer: (B)
Explanation:
The probability of a collision occurring is dependent on the number of items hashed (n) and the size of the hash table (m). As the number of items increases, the probability of a collision also increases. However, as the size of the hash table increases, the probability decreases. Therefore, the probability of a collision can be estimated as O(n/m).
Quiz of this Question
Please comment below if you find anything wrong in the above post
Please Login to comment...