Double Hashing
Probe sequence is
- h1(k) mod size
- (h1(k) + 1 ? h2(x)) mod size
- (h1(k) + 2 ? h2(x)) mod size
- …
Code for finding the next linear probe:
bool findEntry(const Key & k, Entry *& entry) {
int probePoint = hash1(k), hashIncr = hash2(k);
entry = &table[probePoint];
probePoint = (probePoint + hashIncr) % size;
} while (!entry->isEmpty() && entry->key != k);
return !entry->isEmpty();