Question 61

A hash function defined as f(key) = key mod 7 with linear probing is used to insert the keys 37, 38, 72, 48, 98, 11, 56 into a table indexed from 0 to 6.…

A hash function defined as f(key) = key mod 7 with linear probing is used to insert the keys 37, 38, 72, 48, 98, 11, 56 into a table indexed from 0 to 6. What will be the location of 11?
  1. A3
  2. B4
  3. C5
  4. D6
Show answerHide answer

Correct answer: (C) 5

Explanation

37→2, 38→3, 72→2 (taken, goes to 3, then 4), 48→6, 98→0. 11 mod 7 = 4 is taken, so linear probing places 11 at slot 5.

From DSSSB TGT Computer Science Practice Set 2

This is question 61 of DSSSB TGT Computer Science Practice Set 2. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.