Consider a hash table of size seven with starting (6x + 3) mod 4 index zero and a hash function . Assuming the hash table is initially empty. Which of the following is the content of the table when 1, 3, 8, 10, 5 the sequence , is inserted into the table using closed hashing? Here "__ " denotes an empty location in the table.
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. _1,3,8,10,5_ C + +
Explanation
h(1) = 9 mod 4 = 1 → slot 1. h(3) = 21 mod 4 = 1 → taken, slot 2. h(8) = 51 mod 4 = 3 → slot 3. h(10) = 63 mod 4 = 3 → slot 4. h(5) = 33 mod 4 = 1 → next free is 5. Table: _, 1, 3, 8, 10, 5, _.
More Data Structures and Algorithms questions
- Match List I with List II
- Given below are two statements: Statement I: If f and g are two functions and f = O(g) g ≠ o(f) but , we say that the growth rate of g is s…
- Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason R. Assertion A: It is possible to create…
- Given six weights 4, 15, 25, 5, 8, 16, construct a 2-tree (binary tree). What is the minimum weighted path length?
- Consider: A. The number of labelled binary trees possible with n nodes is (2n)!/(n + 1)!. B. The number of binary search trees possible wit…
- Which of the following are correct about Hamiltonian problems? A. The Hamiltonian cycle problem is NP-complete. B. If G is an undirected bi…