question 1
An empty table of 7 slots puts in 12, 5, 19 and 6, in that order. How many probes do the four puts make in all?
the answer, and why
the answer is D
12, 5 and 19 have home 5; 6 has home 6. 12 takes slot 5, 1 probe. 5 walks to slot 6, 2 probes. 19 walks slots 5 and 6 to slot 0, 3 probes. 6 finds slot 6 taken by 5, then slot 0 by 19, and takes slot 1, 3 probes. That is 9.
step 11 of 15
6 leaves 6 when divided by 7, so its home is slot 6.
slots looked at: 0
step 12 of 15
Slot 6 holds 5, not 6.
slots looked at: 1
step 13 of 15
Slot 0 holds 19, not 6.
slots looked at: 2
step 14 of 15
Slot 1 is free, so put 6 there.
slots looked at: 3
if you chose another
- That counts 1 probe a put, as if every home were free.
- That counts 6 as 1 probe, as if its home were free, but 5 took slot 6 on its walk.
- That leaves out 6's put, which makes 3 probes.