Bucketing builds, the hash table as a 2D array instead of a single dimensional array. Every entry in the array is big, sufficient to hold M items (M is not amount of data. Just a constant).
Problems
- Lots of wasted space are created.
- If M is exceeded, another strategy will need to be implemented.
- Not so good performer for memory based implementations but doable if buckets are disk-based.
For bucketing it is ok to have λ>1. However, the larger λ is the higher a chance of collision. λ>1 guarantees there will be minimum 1 collision (pigeon hole principle). That will enhance both the run time and the possibility of running out of buckets.
For a hash table of M locations and Y buckets at each location
- Successful Search - O(Y) worst case
- Unsuccessful Search - O(Y) worst case
- Insertion - O(Y) - assuming success, bucketing does not have good way to handle non-successful insertions.
- Deletion - O(Y)
- Storage: O(M * Y)