Question 1 |

An algorithm has to store several keys generated by an adversary in a hash
table. The adversary is malicious who tries to maximize the number of collisions.
Let k be the number of keys, m be the number of slots in the hash table, and k \gt m.

Which one of the following is the best hashing strategy to counteract the adversary?

Which one of the following is the best hashing strategy to counteract the adversary?

Division method, i.e., use the hash function h(k) = k\; mod \; m | |

Multiplication method, i.e., use the hash function h(k) = \left \lfloor m(kA -\left \lfloor kA \right \rfloor ) \right \rfloor, where
A is a carefully chosen constant. | |

Universal hashing method. | |

If k is a prime number, use Division method. Otherwise, use Multiplication method |

Question 1 Explanation:

Question 2 |

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 2 Explanation:

Question 3 |

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 3 Explanation:

Question 4 |

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 4 Explanation:

Question 5 |

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 5 Explanation:

There are 5 questions to complete.

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

option D in question number 10 should be -> (12*i^2)mod 10 please fix it

Option D updated.