A double-hashing table has capacity m=11m=11m=11 and uses
where h1(k)=k mod 11h_1(k)=k\bmod 11h1(k)=kmod11 and h2(k)=1+(k mod 10)h_2(k)=1+(k\bmod 10)h2(k)=1+(kmod10). A tombstone marks a removed entry; searches continue past it. In the table below, D denotes a tombstone. There are no EMPTY slots.
Slot
Contents
0
1
2
17
3
4
D
5
6
7
8
9
10
A removal searches until it finds its key or completes one full probe cycle. A successful removal replaces the key with a tombstone. Each slot inspected counts once, including tombstones; revisiting the starting slot is not counted.
Starting independently from this snapshot for each operation, find the number of slot inspections required to remove key 17 and to attempt to remove absent key 28. Give both counts as exact integers.
Unlock full course notes by signing up
Following a double-hashing probe sequence
A hash table has 17 slots, numbered 0 to 16, and uses double hashing with h1(k)=k mod 17h_1(k) = k \bmod 17h1(k)=kmod17 and h2(k)=1+(k mod 13)h_2(k) = 1 + (k \bmod 13)h2(k)=1+(kmod13), so probe iii is slot (h1(k)+i⋅h2(k)) mod 17(h_1(k) + i \cdot h_2(k)) \bmod 17(h1(k)+i⋅h2(k))mod17. Slots 6, 7 and 15 are occupied, and every other slot is empty. Key 125 is inserted. In which slot does it end up? Give the slot index as a whole number.
Tombstones and unsuccessful search cost
An open-addressed hash table with 2000 slots uses double hashing. After a long run of insertions and removals it holds 1200 live keys and 400 tombstones; the remaining slots are empty. Treat the live keys and tombstones as scattered at random, and use the uniform-hashing estimate of 1/(1−α)1/(1 - \alpha)1/(1−α) probes for an unsuccessful search, where α\alphaα is the fraction of slots at which a search cannot stop. Find the expected number of probes for an unsuccessful search now, and after the table is rebuilt into a fresh 2000-slot array that holds only the live keys. Give both to one decimal place.
Tracing insertions around a tombstone
A hash table has 11 slots, numbered 0 to 10, and uses double hashing with h1(k)=k mod 11h_1(k) = k \bmod 11h1(k)=kmod11 and h2(k)=1+(k mod 7)h_2(k) = 1 + (k \bmod 7)h2(k)=1+(kmod7); probe iii is slot (h1(k)+i⋅h2(k)) mod 11(h_1(k) + i \cdot h_2(k)) \bmod 11(h1(k)+i⋅h2(k))mod11. A removal leaves a tombstone. An insertion probes until it reaches an empty slot, confirming the key is absent, and then stores the key in the first tombstone it passed, or in that empty slot if it passed none. Starting from an empty table, perform: insert 35, insert 46, insert 57, remove 46, insert 123, insert 18. For each key still in the table, give its final slot and the number of slots its insertion examined.
Auditing relocation after a removal
A double-hashing table has capacity 11 and uses
A search stops when it finds its key or an EMPTY slot. A tombstone is a removed-entry marker that the search passes over. The initial table is shown below; E denotes EMPTY.