Question: Suppose that we are given a key k to search for in a hash table with positions 0, 1, ..., m - 1, and suppose

Suppose that we are given a key k to search for in a hash table with positions 0, 1, ..., m - 1, and suppose that we have a hash function h mapping the key space into the set {0, 1, ..., m -1. The search scheme is as follows.
1. Compute the value i ← h(k), and set j ← 0.
2. Probe in position i for the desired key k. If you find it, or if this position is empty, terminate the search.
3. Set j ← (j + 1) mod m and i ← (i + j) mod m, and return to step 2. Assume that m is a power of 2.
a. Show that this scheme is an instance of the general "quadratic probing" scheme by exhibiting the appropriate constants c1 and c2 for equation (11.5).
b. Prove that this algorithm examines every table position in the worst case.

Step by Step Solution

3.32 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a From how the probesequence computation is specified it is easy to see t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

C-S-A (96).docx

120 KBs Word File

Students Have Also Explored These Related Algorithms Questions!