edited by
16,169 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.1k
views
4 answers
26 votes
Kathleen asked Sep 21, 2014
26,113 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^...
19.8k
views
5 answers
76 votes
Kathleen asked Sep 21, 2014
19,772 views
Consider the process of inserting an element into a $Max \: Heap$, where the $Max \: Heap$ is represented by an $array$. Suppose we perform a binary search on the path fr...
8.7k
views
4 answers
29 votes
Kathleen asked Sep 21, 2014
8,711 views
Consider the following C program segment where $CellNode$ represents a node in a binary tree:struct CellNode { struct CellNode *leftChild; int element; struct CellNode *r...
26.2k
views
8 answers
31 votes
Kathleen asked Sep 21, 2014
26,207 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...