A has table has space for 100 records. What is the probability of coll...
If there is only one record, then the probability of a collision will be 1/100. if 2, then 2/100 etc. If 9 then 9/100. So, the required probability is 1 + 2 + 3 ... 9/100 = 0.45.
View all questions of this test
A has table has space for 100 records. What is the probability of coll...
Probability of Collision
To calculate the probability of collision in a hash table, we need to consider the number of records and the size of the table. In this case, we are given that the table has space for 100 records.
The probability of collision is the likelihood that two different records will hash to the same location in the table. This can happen when the hash function produces the same hash value for different inputs.
Calculating the Probability
We are asked to find the probability of collision before the table is 10% full. This means that we need to calculate the probability of collision for the first 10 records.
Let's assume the hash function distributes the records uniformly across the table, meaning each record has an equal probability of being hashed to any location.
Probability of No Collision
To calculate the probability of no collision for the first record, we have 100 empty slots in the table, out of 100 total slots. Therefore, the probability of the first record not colliding with any other records is:
P(no collision for first record) = 100/100 = 1
For the second record, there are now 99 empty slots remaining, out of 100 total slots. The probability of the second record not colliding with any other records is:
P(no collision for second record) = 99/100
Similarly, for the third record, there are 98 empty slots remaining, out of 100 total slots. The probability of the third record not colliding with any other records is:
P(no collision for third record) = 98/100
Probability of Collision
The probability of collision for each record is the complement of the probability of no collision. Therefore, the probability of collision for the first record is:
P(collision for first record) = 1 - P(no collision for first record) = 1 - 1 = 0
Similarly, the probability of collision for the second record is:
P(collision for second record) = 1 - P(no collision for second record) = 1 - (99/100) = 1/100
And the probability of collision for the third record is:
P(collision for third record) = 1 - P(no collision for third record) = 1 - (98/100) = 2/100
Probability of Collision for First 10 Records
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
To make sure you are not studying endlessly, EduRev has designed Computer Science Engineering (CSE) study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Computer Science Engineering (CSE).