Outline the steps for inserting an element using a Hash function-
(A) Apply the hash function to compute the index.
(B) Insert the element at the computed index in the hash table.
(C) Check the collision and resolve if any.
(D) Initialize the hash table.
Outline the steps for inserting an element using a Hash function-
(A) Apply the hash function to compute the index.
(B) Insert the element at the computed index in the hash table.
(C) Check the collision and resolve if any.
(D) Initialize the hash table.
Solution
(D) Initialize the hash table, because the table must exist before anything can be stored in it.
(A) Apply the hash function to the key to compute the index.
(B) Insert the element at the computed index.
(C) Check for a collision, where the index is already occupied, and resolve it with chaining or open addressing.
Among the given options, only Option 1 starts with initialization and then follows the hash, insert, collision sequence.
Related questions:
2025: 21 May Shift 1
2026: 11 May Shift 2
2025: 3 June Shift 2
2026: 31 May Shift 1