Question 57

A hash table of length 10 uses open addressing with hash function h(k) = kmod 10 and linear probing. After inserting 6 values into an empty hash table, the…

A hash table of length 10 uses open addressing with hash function h(k) = kmod 10 and linear probing. After inserting 6 values into an empty hash table, the table is shown below: Slot | Key 0 | 1 | 2 | 42 3 | 23 4 | 34 5 | 52 6 | 46 7 | 33 8 | 9 | Which of the following choices gives a possible order in which the key values could have been inserted in the table?
  1. A46, 42, 34, 52, 23, 33
  2. B34, 42, 23, 52, 33, 46
  3. C46, 34, 42, 23, 52, 33
  4. D42, 46, 33, 23, 34, 52
Show answerHide answer

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

Explanation

Order C reproduces the table: 46→6, 34→4, 42→2, 23→3, 52→2 (taken) then 3, 4 (taken) so 5, and 33→3 then 4, 5, 6 (taken) so 7.

From DSSSB TGT Computer Science Practice Set 5

This is question 57 of DSSSB TGT Computer Science Practice Set 5. 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.