Skip to main content

Double hashing table with m = 11

Short answer

With h1(k)=k mod 11 and h2(k)=k mod 9, double hashing places: 76→10, 26→4, 37→5 (i=1), 59→9 (i=1), 21→2 (i=1), 65→1 (i=1). Final table: 0:-, 1:65, 2:21, 3:-, 4:26, 5:37, 6:-, 7:-, 8:-, 9:59, 10:76.

Draw the hash table obtained from double hashing with hash functions h1(k) = k mod 11 and h2(k) = k mod 9 to the keys given by: 76, 26, 37, 59, 21, 65 with table size m = 11. Use hp(k, i) = (h1(k) + i*h2(k)) mod m.

Probe sequence: hp(k, i) = (h1(k) + i·h2(k)) mod 11, with h1 = k mod 11 and h2 = k mod 9. Try i = 0, 1, 2, ... until a free slot is found.

Keyh1h2Probes (i: slot)Slot used
761040: 10 free10
26480: 4 free4
37410: 4 full; 1: (4+1) = 5 free5
59450: 4 full; 1: (4+5) = 9 free9
211030: 10 full; 1: (10+3) mod 11 = 2 free2
651020: 10 full; 1: (10+2) mod 11 = 1 free1

Final hash table (m = 11)

Index012345678910
Key652126375976

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Structure and Algorithm chapter 8 questions →