GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A table of size 11 uses linear probing with h(k) = k mod 11 and tombstones: a deleted slot is marked DELETED; search continues past DELETED and stops at a never-used slot; an insertion reuses the first DELETED slot seen on its probe path once it knows the key is absent. A probe is one slot examined. Operations: insert 22, 33, 44, 55, 66; delete 33; search 55; insert 77; search 66; delete 22; search 44. How many probes in total (every slot examined counts, including the final slot that holds or ends the search)?

  1. A. 33
  2. B. 40
  3. C. 45
  4. D. 36

Correct answer: D. 36

After the first five inserts the keys sit in slots 0 to 4 (probe counts 1+2+3+4+5 = 15). The remaining operations are traced slot by slot: delete 33 (2), search 55 (4), insert 77 (the whole cluster is scanned to prove absence, then it reuses the tombstone), search 66, delete 22, search 44 give the total 36.

More Programming and Data Structures (GATE) questions

Exams that ask this topic