next up previous
Next: Generating Probe Sequence Up: l5 Previous: Pseudocode

Pseudocode

   Search(T,k)
      i = 0
      repeat
         j = h(k,i)
         if T[j] = k
         then return j
         else i = i + 1
      until (T[j] = NIL) or (i = m)
      return NIL



\psfig{figure=figures/f5-4.ps,width=2in,height=3in}



Delete(k,i) is more difficult, because replacement by NIL may break a possible probe sequence.

Solution: replace deleted key by special symbol. However, in this case search time no longer depends on $\alpha$.

Solution: use chaining when deletions are required.

Hash Table Applet


next up previous
Next: Generating Probe Sequence Up: l5 Previous: Pseudocode