A programmer is auditing insertion into a 151515-slot table indexed from 000 to 141414. A new key has home index 222 and uses pi=(2+i2) mod 15p_i=(2+i^2)\bmod15pi=(2+i2)mod15, starting at i=0i=0i=0. Only slots 2,3,6,112,3,6,112,3,6,11 are occupied; every other slot is empty.
The buggy implementation reports failure as soon as an index repeats. The corrected implementation permits up to 151515 attempts and stops at the first empty slot. Its probe count includes every slot inspection, including repeated visits and the successful empty-slot inspection.
What probe count does the corrected insertion require? Give an exact integer number of inspections.
Unlock full course notes by signing up
Compare insertion inspection totals
A job registry inserts IDs 110,121,112,132,111110,121,112,132,111110,121,112,132,111, in that order, into two initially empty tables. Each table has 111111 slots indexed from 000 to 101010 and uses h(k)=k mod 11h(k)=k\bmod11h(k)=kmod11.
The first table uses pi=(h(k)+i) mod 11p_i=(h(k)+i)\bmod11pi=(h(k)+i)mod11; the second uses pi=(h(k)+i2) mod 11p_i=(h(k)+i^2)\bmod11pi=(h(k)+i2)mod11. In both, iii starts at zero for each new key, and insertion stops at the first empty slot.
A probe is one slot inspection, including the final inspection of an empty slot. Find the total number of inspections for all five insertions under each method. Enter both totals as exact integers.
Separate coverage from empty capacity
A storage index uses quadratic probing with pi(k)=(h(k)+i2) mod mp_i(k)=(h(k)+i^2)\bmod mpi(k)=(h(k)+i2)modm, starting at i=0i=0i=0. The table size mmm is an odd prime, and no entries have been removed. Which statements are guaranteed by these conditions? Select all that apply.
Trace searches through stored identifiers
A job scheduler stores integer identifiers in an 11-slot hash table. Its home index is the initial index assigned to a key, given here by h(k)=k mod 11h(k)=k\bmod 11h(k)=kmod11. Quadratic probing inspects
The table below is the current state. Every empty slot has never been used, and no entries have been deleted. All stored identifiers were inserted using the stated rule.
Measure the search cost of occupied runs
Two 12-slot hash tables use linear probing:
A slot inspection means reading one table position, whether it is occupied or empty. Each search starts at its home index hhh, inspects successive positions, and stops at the first never-used empty slot when the key is absent. Neither table has had deletions.