Quadratic Probing
Probe sequence is
- h(k) mod size
- (h(k) + 1) mod size
- (h(k) + 4) mod size
- (h(k) + 9) mod size
- …
findEntry using quadratic probing:
bool findEntry(const Key & k, Entry *& entry) {
int probePoint = hash1(k), numProbes = 0;
entry = &table[probePoint];
probePoint = (probePoint + 2*numProbes - 1) % size;
} while (!entry->isEmpty() && entry->key != key);
return !entry->isEmpty();