edited by
1,179 views
3 votes
3 votes

Consider a hash table of $9$ slots implemented with linear probing. Suppose we insert $2$ elements in a sequence to a hash table with a simple uniform hashing assumption. What is the probability that we end up with $2$ consecutive slots of the hash table filled?

Slot $i$ and $(i+1) \text{mod m}$ are defined to be consecutive slots.

  1. $1/2$
  2. $1/3$
  3. $1/4$
  4. $2/3$
edited by

4 Answers

6 votes
6 votes
First key can go to any slot. For the second key, we have $3$ options to map (left of first key, right of first key and to the same slot of first key). Hence probability $= 3/9 = 1/3.$
1 votes
1 votes
9C2 ways to select any two slots and then there are 9 possible combinations of the consecutive slots  (1,2),(2,3), (3,4),(4,5) ,(5,6),(6,7),(7,8),(8,9),(9,1).

So shouldn’t it be ¼ ?
0 votes
0 votes
I think consecutive slots be like – (0,1), (1,2), (2,3), (3,4), (4,5),(5,6), ( 6,7),  (7,8) ,(8,0) ==== 9 choices and  the total number of options we have is 9C2 = 9 / 9C2  ==== ¼ ??
edited by
0 votes
0 votes
First we select 2 places out of 9 places and then there are 9 possible combinations of the consecutive slots (0,1) ,(1,2) ,(2,3),(3,4),(4,5),(5,6),(6,7),(7,8),(8,0)

so Answer is the ¼.
Answer:

Related questions

2 votes
2 votes
1 answer
1