Double Hashing
This is an alternative to Linear Probing. Learning in CS240.
Double hashing: open addressing with probe sequence
- search, insert, delete work just like for Linear Probing, but with this different probe sequence.
Independent Hash Functions
The two hash functions should be independent. Using two modular hash-functions may often lead to dependencies. This is why we use multiplication method for second hash function: , where
- is some floating-point number with computes fractional part of , which is in
- Multiply with to get floating-point number in
- Round down to get integer in
Some observations/suggestions:
- Multiplying with is used to scramble the keys.
- Good scrambling is achieved with