ProgrammingVery hard

Linear probing with a tombstone-free delete: keys 0 and 7 both hash to slot 0 in a table of size 7. 0 is stored at slot 0 and 7 at slot 1. The program deletes 0 by setting slot 0 to empty. What does find(7) return?

  1. A. found at slot 1
  2. B. not found, because the search stops at the empty slot 0
  3. C. found at slot 0
  4. D. it loops forever

Correct answer: B. not found, because the search stops at the empty slot 0

A lookup stops at the first empty slot, so emptying slot 0 hides 7 even though it sits at slot 1. Deletion needs a tombstone marker, not an empty slot.

More C Programming questions

Exams that ask this topic