Question: Suppose that a hash table contains hash_size = 13 entries indexed from 0 through 12 and that the following keys are to be mapped into
Suppose that a hash table contains hash_size = 13 entries indexed from 0 through 12 and that the following keys are to be mapped into the table:
10 100 32 45 58 126 400
(a) Assume that the hash table uses key % hash_size as the hash function and that linear probing is used, present the content of the hash table using the following table. Also answer how many collisions occur when these keys are inserted into the table. (10 pts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
(b) Assume that the hash table uses key % hash_size as the hash function and that quadratic probing is used, present the content of the hash table using the following table. Also answer how many collisions occur when these keys are inserted into the table. (10 pts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
(c) Assume that the hash table uses (sum of all digits of the key) % hash_size as the hash function and that quadratic probing is used, present the content of the hash table using the following table. Also answer how many collisions occur when these keys are inserted into the table. (10 pts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
