Skip to content
Related Articles

Related Articles

UGC-NET | UGC NET CS 2018 July – II | Question 70

View Discussion
Improve Article
Save Article
  • Last Updated : 25 Oct, 2018

Consider a hash table of size seven, with starting index zero, and a hash function (7x+3) mod 4. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing ? Here “__” denotes an empty location in the table.
(A) 3, 10, 1, 8, __ , __ , __
(B) 1, 3, 8, 10, __ , __ , __
(C) 1, __ , 3, __ , 8, __ , 10
(D) 3, 10, __ , __ , 8, __ , __


Answer: (A)

Explanation: Keys are 1, 3, 8, 10.
h(x) = (7*x + 3)
h(1) = (10) mod 4 = 2
h(3) = (7 * 3 + 3) mod 4 = 24 mod 4 = 0
h(8) = (7 * 8 + 3) mod 4 = 3
h(10)= (7 * 10 + 3)mod 4 = 1
i.e. 3, 10, 1, 8, __ , __ , __
So, option (A) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!