GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A hash table starts with 7 slots, uses linear probing with h(k) = k mod size, and after each insertion, if the load factor exceeds 0.7, it grows to 2 * size + 1 and reinserts the existing keys in the old table's slot order (each reinsertion counts probes too). Keys 10, 20, 30, 40, 50, 60, 70, 80 are inserted in order. What is the total number of probes (a probe is a slot examined) and the final table size?

  1. A. 20 probes, size 15
  2. B. 18 probes, size 15
  3. C. 20 probes, size 7
  4. D. 23 probes, size 31

Correct answer: A. 20 probes, size 15

Rehashing happens when the load factor passes 0.7 (1 time(s)); tracing every insertion and reinsertion gives 20 probes and a final size of 15.

More Programming and Data Structures (GATE) questions

Exams that ask this topic