Data Structures and Algorithms20795 marksNumerical: hashing collision resolutionHashing
Assume you have to store the data {0,1,2,4,5,7} into a hash table of size 5, with hash function, h(x) = x % 5. Apply linear probing and double hashing as collision resolution techniques.
Assume you have to store the data {0,1,2,4,5,7} into a hash table of size 5, with hash function, $h(x) = x % 5$. Apply linear probing and double hashing as collision resolution techniques. [5]
- Data set (in insertion order): {0, 1, 2, 4, 5, 7} → 6 keys - Hash table size: m = 5 (slots 0 to 4) - Primary hash function: h(x) = x % 5 Observation: 6 keys into a table of size 5 means the table can hold at most 5 keys. The 6th key must overflow. --- Probe formula: