next up previous
Next: Hash Tables Up: CSE 2320: Algorithms and Previous: Operations

What if the keys are not unique?



Solution 1: Insert implies Replace



Solution 2:

If we assume a uniform distribution over keys, a $\Theta(1)$ search is maintained.



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

If we can maintain $\Theta(1)$ performance for multiple entries for the same key, perhaps we can do the same while mapping multiple keys into the same array element.



In other words, use Hash Tables.



Copyright © 1998 The University of Texas at Arlington