Question 1 |

Suppose we are given n keys, m hash table slots, and two simple uniform hash functions h_1 and h_2. Further suppose our hashing scheme uses h_1 for the odd keys
and h_2 for the even keys. What is the expected number of keys in a slot?

\frac{m}{n} | |

\frac{n}{m} | |

\frac{2n}{m} | |

\frac{n}{2m} |

Question 1 Explanation:

Question 2 |

Consider a dynamic hashing approach for 4-bit integer keys:

1. There is a main hash table of size 4.

2. The 2 least significant bits of a key is used to index into the main hash table.

3. Initially, the main hash table entries are empty.

4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a main hash table. entry is organized as a binary tree that grows on demand.

5. First, the 3rd least significant bit is used to divide the keys into left and right subtrees.

6. To resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees based on the 4th least significant bit.

7. A split is done only if it is needed, i.e., only when there is a collision.

Consider the following state of the hash table.

Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?

1. There is a main hash table of size 4.

2. The 2 least significant bits of a key is used to index into the main hash table.

3. Initially, the main hash table entries are empty.

4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a main hash table. entry is organized as a binary tree that grows on demand.

5. First, the 3rd least significant bit is used to divide the keys into left and right subtrees.

6. To resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees based on the 4th least significant bit.

7. A split is done only if it is needed, i.e., only when there is a collision.

Consider the following state of the hash table.

Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?

5,9,4,13,10,7 | |

9,5,10,6,7,1 | |

10,9,6,7,5,13 | |

9,5,13,6,10,14 |

Question 2 Explanation:

Question 3 |

In linear hashing, if blocking factor bfr, loading factor i and file buckets N are known, the number of records will be

r=i+bfr+N | |

r=i-bfr-N | |

r=i+bfr-N | |

r=i*bfr*N |

Question 3 Explanation:

Question 4 |

Consider a double hashing scheme in which the primary hash function is h_1(k)=k\; mod \; 23, and the secondary hash function is h_2(k)=1+(k\; mod \; 19). Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value k=90 is_____________.

21 | |

15 | |

13 | |

17 |

Question 4 Explanation:

Question 5 |

A hash table with 10 buckets with one slot pet per bucket is depicted here. The symbols, S1 to S7 are initially entered using a hashing function with linear probing. The maximum number of comparisons needed in searching an item that is not present is:

\begin{array}{|c|c|} \hline 0 & S 7 \\ \hline 1 & S 1 \\ \hline 2 & \\ \hline 3 & S 4 \\ \hline 4 & S 2 \\ \hline 5 & \\ \hline 6 & S 5 \\ \hline 7 & \\ \hline 8 & S 6 \\ \hline 9 & S 3 \\ \hline \end{array}

\begin{array}{|c|c|} \hline 0 & S 7 \\ \hline 1 & S 1 \\ \hline 2 & \\ \hline 3 & S 4 \\ \hline 4 & S 2 \\ \hline 5 & \\ \hline 6 & S 5 \\ \hline 7 & \\ \hline 8 & S 6 \\ \hline 9 & S 3 \\ \hline \end{array}

4 | |

5 | |

6 | |

3 |

Question 5 Explanation:

Question 6 |

A Hash Function f defined as f(key)=keymod7. With linear probing while inserting the keys 37,38,72,48,98,11,56 into a table indexed from 0, in which location key 11 will be stored (Count table index 0 as 0^{th} location)?

3 | |

4 | |

5 | |

6 |

Question 6 Explanation:

Question 7 |

A hash table with ten buckets with one slot per bucket is shown in the following figure. The symbols S1 to S7 initially entered using a hashing function with linear probing. The maximum number of comparisons needed in searching an item that is not present is

4 | |

5 | |

6 | |

3 |

Question 7 Explanation:

Question 8 |

Given a hash table T with 25 slots that stores 2000 elements, the load factor \alpha for T is ____________.

2000 | |

25 | |

80 | |

160 |

Question 8 Explanation:

Question 9 |

Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?

h(i)= i^{2} mod 10 | |

h(i)= i^{3} mod 10 | |

h(i)=(11*i^{2}) mod 10 | |

h(i)=(12*i) mod 10 |

Question 9 Explanation:

Question 10 |

Consider a 13 element hash table for which f(key)=key mod 13 is used with integer keys. Assuming linear probing is used for collision resolution, at which location would the key 103 be inserted, if the keys 661, 182, 24 and 103 are inserted in that order?

0 | |

1 | |

11 | |

12 |

Question 10 Explanation:

There are 10 questions to complete.

Ques no 1 point 5 please remove the last line ,it is changing the meaning of the question.