next up previous
Next: Hash Tables Up: l5 Previous: Operations

What if the keys are not unique?



Solution 1: Insert implies Replace



Solution 2: Array elements are pointers to lists.

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.


next up previous
Next: Hash Tables Up: l5 Previous: Operations