8.Hashing (1)
Hashing: The process of mapping a key value to a position in a table.
A hash function maps key values to positions. It is denoted by \(h\).
A hash table is an array that holds the records. It is denoted by HT.
HT has \(M\) slots, indexed form 0 to \(M-1\).
Hashing (2)
For any value \(K\) in the key range and some hash function
\(h\), \(h(K) = i\), \(0 <= i < M\), such that
key(HT[i]) \(= K\).
Hashing is appropriate only for sets (no duplicates).
Good for both in-memory and disk-based applications.
Answers the question “What record, if any, has key value K?”