in DS recategorized
3,045 views
1 vote
1 vote

Consider a hash table of sze seven, with starting index zero, and a hash function (7x+3) mod 4. Assuming that 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.

  1. 3, 10, 1, 8, ___ , ____ , ____
  2. 1, 3, 8, 10, ___, ___, ___
  3. 1, ___, 3, ___, 8, ___, 10
  4. 3, 10, ___, ____, 8, ___, ___
in DS recategorized
3.0k views

1 Answer

1 vote
1 vote
Put the values 1,3,8,10 in Hash Function.

For 1 -> (7*1+3) mod 4 = 2 , So 1 will go at location 2.

For 3-> (7*3+3) mod 4 = 0, So 3 will go at location 0.

and so on.

Option (1) is correct.

Related questions