The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
221 views
A hash table has space for 100 records .what is the probability of collision before it is 5% full??

 

a. 0.25

b. 0.10

c. 0.40

d. 0.20
closed as a duplicate of: Doubt
asked in Algorithms by Loyal (4.3k points)
closed by | 221 views
Sir,  Then (1-(99/100)*(98/100)*(97/100)*(96/100))=.096 so option b
in that case chose the nearest one :) Which exam?
May be some test series Sir. actually someone posted the qs on FB group :)

2 Answers

+2 votes

 required probability =   ((100*1 )/ 1002) + ((100*99*2 ) / 1003) +.....+((100*99*98*97*4 ) / 1005) = 0.096= 0.10( appox)

option B is correct

answered by Boss (7.1k points)
edited by
0 votes

Hash table will be 5% full.

Max collision possible,

In 1 insertion of record there is 0 collision.

" 2      "       "     "         "     "  1    "

"  3     "       "     "         "     "   2   "

"  4    "        "     "        "     "  3   "

Before 5% full there are maximum 6 collision

So, there are total collision possible 0+1+2+.....+6=21

 

answered by Veteran (69.8k points)
here max 6 collision i got it but why u write 0+1+2+..+6 plz explain???
Depends on the collision resolution method to be used.If chaing it would be different i guess
@kishalas why not only 6 collision ..
Think of chaining Collision resolution technique...

Suppose while inserting all get same slot(lets say slot 1) and pushed in chain.Then in worst case all will be hashed to only one slot.And in that case there will be as many number of collision as the number of records to be hashed(almost) and only one slot get filled.
Actually before 5% full,
there is a case 0% full ,So, no collision
1%full=maximum 1 collision
2%full =maximum 2 collision
......
4% full=6 collision
right?


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,831 questions
36,676 answers
90,577 comments
34,638 users