edited by
10,556 views
54 votes
54 votes

Consider a hash table with $n$ buckets, where external (overflow) chaining is used to resolve collisions. The hash function is such that the probability that a key value is hashed to a particular bucket is $\frac{1}{n}$. The hash table is initially empty and $K$ distinct values are inserted in the table.

  1. What is the probability that bucket number $1$ is empty after the $K^{th}$ insertion?
  2. What is the probability that no collision has occurred in any of the $K$ insertions?
  3. What is the probability that the first collision occurs at the $K^{th}$ insertion?
edited by

6 Answers

0 votes
0 votes
As chaining is used to resolve collision

A.  The first element can go anywhere except the first block so P(getting into other boxes except first)=n-1/n
      Here block A continues to be empty so probability = n-1/n * n-1/n * ......k times = (n-1/n)^k

B.  No collision in k insertions so 1st element can go anywhere similarly 2nd can go to any block except the 1st block
     so, probability = 1 * n-1/n * n-2/n * ......* n-k+1/n

C. If 1st collision occurs at k th insertion then probability = 1 * n-1/n * n-2/n * ...... * n-k+2/n * k-1/n

Related questions

45 votes
45 votes
6 answers
4
Kathleen asked Sep 29, 2014
8,956 views
Let $G$ be the graph with $100$ vertices numbered $1$ to $100$. Two vertices $i$ and $j$ are adjacent if $\vert i-j \vert =8$ or $\vert i-j \vert=12$. The number of con...