Suppose now that I add 3 pieces of data to my \"hash table,\" sending each piece
ID: 3146468 • Letter: S
Question
Suppose now that I add 3 pieces of data to my "hash table," sending each piece of data to one of 50 locations at random. What is the probability that all three land in different locations?
A data structure called a hash table sends data to one of many locations at random (with the hope that the randomness spreads things evenly). If there are 50 locations in the hash table, and I add 2 pieces of data, what is the probability they land in the same location? (Notice that there are 50 locations where this could happen...)
Explanation / Answer
choice for 1st data to land is 50 as it can land to any place.
for second data possible place to land is 49 as one place already occupied by 1st data.
for 3rd data possible places left are 48. now work can be completed if all three data occupy places together
i.e total possible ways 50 x 49 x 48 so that no data occupy same place. now total possibilities of data occupying
places are 50 x 50 x 50. Hence required probability = (50 x 49 x 48) / 50 x 50 x 50 =0.9408 or 94.08 %
if we add two pieces of data then 1st data have 50 places to land but second data has only one as this has
to same place where 1st has land. Hence total possible ways 50 x 1. now total possible ways for landing data
are 50 x 50 x 50 . Hence required probability= (50 x 1) / 50 x 50 x 50 = 1/2500 = 0.0004 or 0.04 %