Starting from:

$25

CS3001301-Homework 3 Solved

Problem 3.1. Consider inserting the keys 10, 22, 17, 28, 15, 4, 31, 88, 59 into a hash table of length ๐‘š = 11 using open addressing with the auxiliary hash function โ„Ž′(๐‘˜) = ๐‘˜ mod ๐‘š. Illustrate the result of inserting these keys using linear probing, using quadratic probing with ๐‘1 = 1 and ๐‘2 = 3, and using double hashing with โ„Ž2(๐‘˜) = 1 + (๐‘˜ mod (๐‘š − 1)).  

 

 

Problem 3.2. Suppose that we are storing a set of n keys into a hash table of size m, what is the best-case searching time, and what is the worst-case searching time? Write down your answer in the form of ๐‘‡(๐‘›) = Θ(๐‘”(๐‘›)). Briefly discuss your answer.

 

 

Problem 3.3. Discuss when (1) we have a very small set of possible keys | U |; (2) we have a very large number of inserted keys n, relative to the number of all possible keys | U |, will hashing still be useful? Explain your answer.  

 

 

Problem 3.4. If the order of the key insertion sequence is changed, will we obtain the same hashed result? Briefly discuss your answer.

 

 

Problem 3.5. Write pseudocode for HASH-DELETE (using the pseudo-codes similar to slides no. 24 & 25), and modify HASH-INSERT accordingly to handle this situation. Let us assume the link to the element that we want to delete has been given.

More products