Problems with Hashing
In ideal scenarios, search cost in hash table is O(1).
Problems with hashing:
- hash function relies on size of array (⇒ can't expand)
- changing the size of the array changes the hash function
- could make array larger, but would need to re-insert all
Item s
- items are stored in (effectively) random order
- if size(KeySpace) size(IndexSpace), collisions inevitable
- collision: k != j && hash(k,N) == hash(j,N)
- if
nitems > nslots , collisions inevitable
|