Data Structures · Question 11 · Medium

Data Structures question 11

Keys 15, 22, 8 and 29 are inserted in that order into an empty hash table of size 7 (slots 0-6) using h(k) = k mod 7 and linear probing. In which slot is 29 stored?

  1. 1
  2. 2
  3. 5
  4. 4
Answer and explanation

Answer: D. 4

Explanation: All four keys hash to slot 1. 15 takes slot 1, 22 probes to slot 2, 8 probes to slot 3, and 29 probes slots 1, 2, 3 and lands in slot 4.

Previous: A circular queue is implemented in an array of size n using front and rear… · Next: The preorder traversal of a Binary Search Tree is 50, 30, 20, 40, 70, 60, 80…

Practise data structures

Try a fresh set of data structures questions with an explanation after every answer, free and without signing up: Data Structures practice. Or sit a full placement mock test.

More data structures questions

More technical & programming practice

Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge