Good Hashing: Multiplication Method
Hash function is defined by size plus a parameter A
hA(k) = ?size * (k*A mod 1)? where 0 < A < 1
Example: size = 10, A = 0.485
hA(50) = ?10 * (50*0.485 mod 1)?
= ?10 * (24.25 mod 1)? = ?10 * 0.25? = 2
- no restriction on size!
- if we’re building a static table, we can try several As
- more computationally intensive than a single mod