- #1
lina29
- 85
- 0
Homework Statement
Consider a hash table T with 11 entries and the hash function h(x) = x mod 11. Show the result of hashing the keys 10,16,11,43,33,13,14,12,3, and 22, assuming collisions are handled by
(a) open addressing with linear probing
(b) double hashing using a secondary hash function h′(x) = 5−(x mod 5)
Homework Equations
The Attempt at a Solution
I believe I have the correct answer, I just want to double-check since I'm having difficulties.
Using a table I have:
Key ---- h(x) ---- h'(x) ---- probes LP ---- probes DH
10 ---- 10 ---- ---- 10 ---- 10
16 ---- 05 ---- ---- 5 ---- 5
11 ---- 00 ---- ---- 0 ---- 0
43 ---- 10 ---- 2 ---- 10, 0, 1 ---- 10,2
33 ---- 00 ---- 2 ---- 0, 1, 2 ---- 0, 2, 3
13 ---- 02 ---- 2 ---- 2,3 ---- 2,2,3,4
14 ---- 03 ---- 1 ---- 3,4 ---- 3,1
12 ---- 01 ---- 3 ---- 1,2,3,4,5,6 ---- 1,3,4,5,6
03 ---- 03 ---- 2 ---- 3,4,5,6,7 ---- 3,2,3,4,5,6,7
22 ---- 00 ---- 3 ---- 0,1,2,3,4,5,6,7,8 ---- 0,3,4,5,6,7,8