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.
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: A. 3, 10, 1, 8, __ , __ , __
Explanation
h(x) = (7x + 3) mod 4: 1 → 2, 3 → 0, 8 → 3, 10 → 1. The table reads 3, 10, 1, 8, _, _, _.
More Data Structures and Algorithms questions
- E is the number of edges in the graph and f is maximum flow in the graph. When the capacities are integers, the runtime of Ford-Fulberson a…
- Consider a Boolean function of ‘n’ variables. The order of an algorithm that determines whether the Boolean function produces a output 1 is…
- A 5-ary tree is tree in which every internal node has exactly 5 children. The number of left nodes in such a tree with 8 internal nodes wil…
- The maximum number of comparisons needed to sort 9 items using radix sort is (assume each item is 5 digit octal number) :
- Match the following with respect to algorithm paradigms :
- A binary search tree in which every non-leaf node has non-empty left and right subtrees is called a strictly binary tree. Such a tree with…