Skip to main content

Linear probing insertion into size-10 table

Short answer

With h(k)=k mod 10 and linear probing, keys 62,37,36,44,67,91,82,107 are placed at indices 2,7,6,4,8,1,3,9 respectively after resolving collisions. Final table: 0:-, 1:91, 2:62, 3:82, 4:44, 5:-, 6:36, 7:37, 8:67, 9:107.

Consider a hash table of size 10. Using linear probing, insert the keys 62, 37, 36, 44, 67, 91, 82 and 107.

Table size m = 10, h(k) = k mod 10. If slot h(k) is full, try (h(k) + i) mod 10 for i = 1, 2, ...

Keyh(k)ProbesSlot used
62222
37777
36666
44444
677 (full)7, 88
91111
822 (full)2, 33
1077 (full)7, 8 (full), 99

Final hash table

Index0123456789
Key91628244363767107

Slots 0 and 5 remain empty.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Structure and Algorithm chapter 8 questions →