GATE CSE
First time here? Checkout the FAQ!
x
0 votes
164 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 (3k points)  
closed by | 164 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 (51.6k 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 Feb 2017
  1. Arjun

    4704 Points

  2. Bikram

    4004 Points

  3. Habibkhan

    3738 Points

  4. Aboveallplayer

    2966 Points

  5. sriv_shubham

    2278 Points

  6. Smriti012

    2212 Points

  7. Arnabi

    1814 Points

  8. Debashish Deka

    1788 Points

  9. sh!va

    1444 Points

  10. mcjoshi

    1444 Points

Monthly Topper: Rs. 500 gift card

20,788 questions
25,938 answers
59,535 comments
21,929 users