GATE CSE
First time here? Checkout the FAQ!
x
0 votes
202 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.7k points)  
closed by | 202 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.6k 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 (58.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 Sep 2017
  1. Habibkhan

    6970 Points

  2. Warrior

    2490 Points

  3. Arjun

    2368 Points

  4. rishu_darkshadow

    2136 Points

  5. A_i_$_h

    2004 Points

  6. nikunj

    1980 Points

  7. makhdoom ghaya

    1760 Points

  8. manu00x

    1750 Points

  9. Bikram

    1744 Points

  10. SiddharthMahapatra

    1718 Points


26,060 questions
33,668 answers
79,747 comments
31,079 users