The GATE Grind

GATE 2010 CS (CS1) – Question 62

Algorithms · Searching, Sorting and Hashing · 2 marks · Multiple choice

A ten-slot hash table uses h(k)=k mod 10 and linear probing. Its occupied slots are 2:42, 3:23, 4:34, 5:52, 6:46, 7:33; all others are empty. Which insertion order could produce this table?

  1. 46,42,34,52,23,33
  2. 34,42,23,52,33,46
  3. 46,34,42,23,52,33
  4. 42,46,33,23,34,52

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) 46,34,42,23,52,33

Explanation

In C, 46 occupies six, 34 occupies four, 42 occupies two, and 23 occupies three. Then 52 probes occupied two,three,four and takes five. Finally 33 probes three through six and takes seven. The other orders place either 52 or 33 in a different earlier empty slot. Thus C.

More Searching, Sorting and Hashing questions

All Searching, Sorting and Hashing questions →