Data Structures · Question 23 · Medium
Data Structures question 23
The keys 12, 22, 35, 42, 55, 7, 17 are inserted into a hash table of size 10 using h(k) = k mod 10, and collisions are resolved by separate chaining. How many keys are in the longest chain?
- 3
- 4
- 2
- 1
Answer and explanation
Answer: A. 3
Explanation: Slot 2 gets 12, 22 and 42; slot 5 gets 35 and 55; slot 7 gets 7 and 17. The longest chain is in slot 2 with 3 keys.
Previous: What is the prefix (Polish) form of the infix expression (A + B) * (C - D) ? · Next: An undirected simple graph has 6 vertices whose degrees are 3, 3, 2, 2, 2 and…
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
- Which of the following is a non-linear data structure?
- The keys 45, 20, 60, 10, 30, 25, 50 are inserted in that order into an empty…
- What is the prefix (Polish) form of the infix expression (A + B) * (C - D) ?
- An undirected simple graph has 6 vertices whose degrees are 3, 3, 2, 2, 2 and…
- In a doubly linked list, you are given a pointer to a node (not the head or…
- An array-based binary min-heap holds [2, 5, 3, 9, 6, 4, 8]. One deleteMin…
- A binary tree has preorder traversal A B D E H C F G and inorder traversal D B…
- The keys 10, 20, 30, 25, 28 are inserted in that order into an empty AVL tree…
- The numbers 1, 2, 3, 4, 5 are pushed onto a stack in that order, and pops may…
- A max-heap of 15 distinct keys is stored in array positions 1 to 15. How many…
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