edited by
15,870 views
26 votes
26 votes

Consider a hash table of size seven, with starting index zero, and a hash function $(3x + 4)\mod 7$. 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? Note that − denotes an empty location in the table.

  1. $8$, −, −, −, −, −, $10$

  2. $1, 8, 10$, −, −, −, $3$

  3. $1$, −, −, −, −, −, $3$

  4. $1, 10, 8$, −, −, −,$ 3$

edited by

3 Answers

Best answer
26 votes
26 votes

The answer is (B).

$1$ will occupy location $0, 3$ will occupy location $6, 8$ hashed to location $0$ which is already occupied so, it will be hashed to one location next to it. i.e. to location $1$.

Since $10$ also clashes, so it will be hashed to location $2$.

edited by
Answer:

Related questions

26 votes
26 votes
4 answers
1
Kathleen asked Sep 21, 2014
25,729 views
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height $h$ is:$2^h -1$$2^{h-1} -1$$2^...
31 votes
31 votes
8 answers
4
Kathleen asked Sep 21, 2014
25,779 views
A complete $n-ary$ tree is a tree in which each node has $n$ children or no children. Let $I$ be the number of internal nodes and $L$ be the number of leaves in a complet...