A hash function randomly distributes records one by one in a space tha...
Probability for the first record not colliding is x/x.
Probability for the second record not colliding is x - 1/x. (This is because one place is already occupied. So favorable number of cases is x-1).
Probability for the third record not colliding is x - 2/x.
Probability for the (m - 1)th record not colliding is x - (m - 2)/x.
Now the next (mth) record is resulting in a collision. Out of the x places, it should hash to one of the (m - 1) places already, filled. So probability is (m - 1)/x.
The required probability is (x/x) (x - 1/x) (x - 2/x) ...(x - (m - 2)/x) (m - 1/x)
View all questions of this test
A hash function randomly distributes records one by one in a space tha...
The Answer Explained:
To understand why option 'A' is the correct answer, let's break down the probability calculation step by step.
Step 1: Probability of the first record not causing a collision
When the first record is inserted into the hash space, it does not collide with any existing records. The probability of this happening is 1 (since there are no other records to collide with).
Step 2: Probability of the second record not causing a collision
When the second record is inserted, there is already one record in the hash space. The probability of the second record not causing a collision is (x-1)/x. This is because there are x-1 empty slots available out of x total slots, and the second record should not occupy the same slot as the first record.
Step 3: Probability of the third record not causing a collision
When the third record is inserted, there are already two records in the hash space. The probability of the third record not causing a collision is (x-2)/x. This is because there are x-2 empty slots available out of x total slots, and the third record should not occupy the same slot as the first two records.
Step m: Probability of the mth record not causing a collision
Following the same logic, when the mth record is inserted, there are already (m-1) records in the hash space. The probability of the mth record not causing a collision is (x-(m-1))/x. This is because there are x-(m-1) empty slots available out of x total slots, and the mth record should not occupy the same slot as the previous (m-1) records.
Step (m+1): Probability of the (m+1)th record causing a collision
Now, when the (m+1)th record is inserted, there are already m records in the hash space. The probability of the (m+1)th record causing a collision is 1 - [(x-(m-1))/x]. This is because the (m+1)th record can only cause a collision if it occupies the same slot as one of the previous m records.
Overall probability:
To calculate the overall probability that the mth record is the first record to result in a collision, we multiply the probabilities from step 1 to step (m+1) together. This can be represented as:
1 * ((x-1)/x) * ((x-2)/x) * ... * (x-(m-2))/(x * (x-(m-1))/x)
Simplifying this expression, we get:
(x-1) * (x-2) * ... * (x-(m-2)) * (m-1) / xm-1
Therefore, the correct answer is option 'A': (x-1) * (x-2) * ... * (x-(m-2)) * (m-1) / xm-1.
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).