GATE CSE
First time here? Checkout the FAQ!
x
0 votes
191 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.5k points)  
closed by | 191 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.4k 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 (55.7k 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 Jul 2017
  1. Bikram

    5784 Points

  2. manu00x

    3602 Points

  3. Arjun

    1988 Points

  4. Debashish Deka

    1924 Points

  5. joshi_nitish

    1908 Points

  6. pawan kumarln

    1680 Points

  7. Tesla!

    1426 Points

  8. Hemant Parihar

    1334 Points

  9. Shubhanshu

    1180 Points

  10. Arnab Bhadra

    1124 Points


24,169 questions
31,187 answers
71,039 comments
29,512 users