GATE CSE
First time here? Checkout the FAQ!
x
0 votes
172 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 (3.3k points)  
closed by | 172 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 (6.3k 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 (52.4k 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?


Top Users Mar 2017
  1. rude

    4018 Points

  2. sh!va

    2994 Points

  3. Rahul Jain25

    2804 Points

  4. Kapil

    2608 Points

  5. Debashish Deka

    2104 Points

  6. 2018

    1414 Points

  7. Vignesh Sekar

    1336 Points

  8. Bikram

    1218 Points

  9. Akriti sood

    1186 Points

  10. Sanjay Sharma

    1016 Points

Monthly Topper: Rs. 500 gift card

21,445 questions
26,757 answers
60,936 comments
22,954 users