Consider a hash function that distributes keys uniformly. The hash tab...
For each entry probability of collision is 1/20 {as possible total spaces =20, and an entry will go into only 1 place}
Say after inserting x values probability becomes ½
(1/20).x = ½
X=10
View all questions of this test
Consider a hash function that distributes keys uniformly. The hash tab...
Solution:
Given, the hash table size is 20.
Let the probability of collision after hashing 'n' keys be p(n).
We need to find the value of 'n' such that p(n) > 0.5.
Since the hash function distributes keys uniformly, the probability of collision between any two keys is 1/m, where m is the size of the hash table.
Let's assume that 'n' keys have been hashed already. Then, the number of possible pairs of keys that could collide is n(n-1)/2. Each pair has a collision probability of 1/20.
Therefore, the probability of collision after hashing 'n' keys is given by:
p(n) = n(n-1)/2 * 1/20 = n(n-1)/40
To find the value of 'n' such that p(n) > 0.5, we need to solve the following inequality:
n(n-1)/40 > 0.5
Simplifying this inequality, we get:
n^2 - n - 20 > 0
Solving for 'n' using the quadratic formula, we get:
n > (1 + sqrt(81))/2 or n < (1="" -="" />
n > 9.06 or n < />
Since 'n' is a positive integer, we can ignore the negative solution.
Therefore, the smallest integer value of 'n' that satisfies the inequality is:
n = 10
Hence, after hashing 10 keys, the probability that any new key hashed collides with an existing one exceeds 0.5.
Consider a hash function that distributes keys uniformly. The hash tab...
Consider a hash function that distributes key uniformly the hash table size is 20 and exceed 0.5
ans 50 by 20 10 ans