nextupprevious
Next:3.6.2 Result 2: InsertionUp:3.6 Analysis of Closed HashingPrevious:3.6 Analysis of Closed Hashing

3.6.1 Result 1: Unsuccessful Search

 $ \mbox{$\bullet$}$
The expected number of probes in an unsuccessful search $ \leq$$ {\frac{1}{1 -\alpha}}$
Proof: In an unsuccessful search, every probe but the last accesses an occupied slot that does not contain the desired key and the last slot probed is empty.

 

 
 
 

Let the random variable X denote the number of occupied slots probed before hitting an empty slot. X can take values 0, 1,..., n. It is easy to see that the expected number of probes in an unsuccessful search is 1 + E[X].

pi = P{$\displaystyle \mbox{ exactly $i$\space probes access occupied slots}$}, for i = 0, 1, 2,...  

for i > n, pi = 0 since we can find at most n occupied slots.

Thus the expected number of probes 
                                                        = 1 + $\displaystyle \sum_{i=0}^{n}$ipi                                                 (*)
To evaluate (*), define 

                   qi = P{at least  i  probes access occupied slots}
and use the identity: 
                $\displaystyle \sum_{i=0}^{n}$ipi$\displaystyle \sum_{i=1}^{n}$qi
To compute qi, we proceed as follows: 
                                        q1$\displaystyle {\frac{n}{m}}$
since the probability that the first probe accesses an occupied slot is n/m.

With uniform hashing, a second probe, if necessary, is to one of the remaining m - 1 unprobed slots, n - 1 of which are occupied. Thus 
                                        q2$\displaystyle \left(\vphantom{\frac{n}{m}}\right.$$\displaystyle {\frac{n}{m}}$$\displaystyle \left.\vphantom{\frac{n}{m}}\right)$$\displaystyle \left(\vphantom{\frac{n-1}{m-1}}\right.$$\displaystyle {\frac{n-1}{m-1}}$$\displaystyle \left.\vphantom{\frac{n-1}{m-1}}\right)$
since we make a second probe only if the first probe accesses an occupied slot.

In general,

qi = $\displaystyle \left(\vphantom{\frac{n}{m}}\right.$$\displaystyle {\frac{n}{m}}$$\displaystyle \left.\vphantom{\frac{n}{m}}\right)$$\displaystyle \left(\vphantom{\frac{n-1}{m-1}}\right.$$\displaystyle {\frac{n-1}{m-1}}$$\displaystyle \left.\vphantom{\frac{n-1}{m-1}}\right)$ ... $\displaystyle \left(\vphantom{\frac{n-i+1}{m-i+1}}\right.$$\displaystyle {\frac{n-i+1}{m-i+1}}$$\displaystyle \left.\vphantom{\frac{n-i+1}{m-i+1}}\right)$
     
  $\displaystyle \leq$ $\displaystyle \left(\vphantom{\frac{n}{m}}\right.$$\displaystyle {\frac{n}{m}}$$\displaystyle \left.\vphantom{\frac{n}{m}}\right)^{i{_}}_{}$$\displaystyle \alpha^{i}_{}$  since $\displaystyle {\frac{n-j}{m-j}}$$\displaystyle \leq$$\displaystyle {\frac{n}{m}}$  

Thus the expected number of probes in an unsuccessful search

  = 1 + $\displaystyle \sum_{i=o}^{n}$ipi
  $\displaystyle \leq$ 1 + $\displaystyle \alpha$$\displaystyle \alpha^{2}_{}$ + ... 
  = $\displaystyle {\frac{1}{1 -\alpha}}$  
 $ \mbox{$\bullet$}$
Intuitive Interpretation of the above:

 

 
 
 

One probe is always made, with probability approximately $ \alpha$ a second probe is needed, with probability approximately $ \alpha^{2}_{}$ a third probe is needed, and so on.


nextupprevious
Next:3.6.2 Result 2: InsertionUp:3.6 Analysis of Closed HashingPrevious:3.6 Analysis of Closed Hashing
eEL,CSA_Dept,IISc,Bangalore