Consider a hash function that distributes keys uniformly. The hash tab...
Probability of hashed 1
st key = 20/20 = 1
Probability of hashed 2nd key with no collision = 19/20
Probability of hashed 3rd key with no collision = 18/20
Similarly, probability of hashed rth key with no collision

According to question: Probability of hashed (n + 1)
th key with collision > 0.5 Probability of hashed (n + 1)
th key with collision
P(C) = 1 - P (Till (n
th) no collision)


19 x 18 x 17 .... x 20 - n + 1 < 0.5 x (20)
n-1 By put n = 5, we get 0.581, for n = 6, we get 0.436, which satisfies the equation.
View all questions of this test
Consider a hash function that distributes keys uniformly. The hash tab...
Probability of Collision in a Hash Table
To understand the answer to this question, let's first understand how the probability of collision in a hash table is calculated.
Given a hash function that distributes keys uniformly, the probability of a collision between two keys is determined by the formula:
P(collision) = 1 - P(no collision)
Where P(no collision) is the probability that a new key hashed does not collide with any existing key in the hash table.
Calculating the Probability of No Collision
In a hash table with a size of 20, the probability of no collision for the first key is 1 (since there are no existing keys).
For the second key, the probability of no collision is 19/20, as it can be hashed to any of the 19 remaining empty slots.
For the third key, the probability of no collision is 18/20, as it can be hashed to any of the 18 remaining empty slots.
Similarly, for the fourth key, the probability of no collision is 17/20.
In general, for the nth key, the probability of no collision is (20 - (n-1))/20.
Finding the Number of Keys for P(collision) > 0.5
We want to find the number of keys after which the probability of collision exceeds 0.5.
So, we need to find the smallest value of n for which P(no collision) < />
Using the formula above, we can calculate the probabilities for different values of n:
P(no collision) for n = 1: 1
P(no collision) for n = 2: 19/20
P(no collision) for n = 3: 18/20
P(no collision) for n = 4: 17/20
Continuing this calculation, we find:
P(no collision) for n = 5: 16/20
P(no collision) for n = 6: 15/20
P(no collision) for n = 7: 14/20
Therefore, for n = 7, the probability of collision exceeds 0.5, as P(no collision) = 14/20 = 0.7.
Conclusion
Based on the calculation above, after hashing 6 keys, the probability that any new key hashed collides with an existing one exceeds 0.5. Therefore, the correct answer is option 'b' - 6.