Hash Functions
Points to note:
- converts
Key value to index value [0..N-1]
- deterministic (key value k always maps to same value)
- use
mod function to map hash value to index value
- spread key values uniformly over address range
(assumes that keys themselves are uniformly distributed)
- as much as possible, h(k) ≠ h(j) if j ≠ k
- cost of computing hash function must be cheap
|