11-3 Quadratic probing
Suppose that we are given a key to search for in a hash table with positions , and suppose that we have a hash function mapping the key space into the set . The search scheme is as follows:
- Compute the value , and set .
- Probe in position for the desired key . If you find it, or if this position is empty, terminate the search.
- Set . If now equals , the table is full, so terminate the search. Otherwise, set , and return to step 2.
Assume that is a power of .
a. Show that this scheme is an instance of the general "quadratic probing" scheme by exhibiting the appropriate constants and for equation .
b. Prove that this algorithm examines every table position in the worst case.
(Removed)