15,519 views
14 votes
14 votes
A Hash table has space for 100 records. Then the probability of collision before the table is 10% full is?

A 0.45
B 0.5
C 0.3
D 0.34 (approximately)

3 Answers

Best answer
22 votes
22 votes

Table has 100 slots. So, for 10% filling it must take 10 slots. Now, the question is like this- collision before 10% full. This should mean the first collision happened before the 10th entry is made. So, the first collision can happen from 2nd entry (for 1st entry there won't be a collision) to 10th entry. So required probability

$ = \frac{100.1}{100^2} + \frac{100.99.2}{100^3} + \frac{100.99.98.3}{100^4} + \dots + \frac{100.99.98\dots 92.9}{100^{10}}\\ \approx 0.37$


Can also be found as 1 - Probability of no collision for first 10 entries.

$ = 1 - \frac{100.99.98.97.96.95.94.93.92.91}{100^{10}} \approx 0.37$

edited by
5 votes
5 votes
When hash table is empty, there is no collision

When in hash table 1 slot is full collision=$\frac{1}{100}$

When in hash table 2 slot is full collision=$\frac{2}{100}$

......................................

When in hash table 9 th slot is full collision=$\frac{9}{100}$

So, before the hash table 10% full the probability of collision is =$\frac{1}{100}+\frac{2}{100}+.........\frac{9}{100}=\frac{45}{100}$
–1 votes
–1 votes

To find the probability of collision for the first 10 records, we need to sum up the individual probabilities of collision for each record.

P(collision for first 10 records) = P(collision for first record) + P(collision for second record) + ... + P(collision for tenth record)

P(collision for first 10 records) = 0 + 1/100 + 2/100 + ... + 9/100

This can be simplified as: P(collision for first 10 records) = (1/100)(1 + 2 + 3 + ... + 9)

The sum of the first 9 positive integers is given by the formula n(n+1)/2, where n is the number of terms.

Therefore, P(collision for first 10 records) =

(1/100)(9(9+1)/2)

= (1/100)(9*10/2)

= 45/100

= 0.45
 

Related questions

1 votes
1 votes
2 answers
2
2 votes
2 votes
1 answer
4
omveer asked Aug 27, 2016
2,466 views
A chained hash table has an array size of 100. What is the maximum number of entries that can be placed in the table ?(A) 100 (B) 200(C) 10000 (D) ...