COS 226 Exercises on Hashing

1. [Exercise 14.17] Give the contents of the hash table that results when you insert items with the keys E A S Y Q U T I O N in that order into an initially empty table of M = 5 lists, using separate chaining with unordered lists. Use the hash function 11 k mod M to transform the kth letter of the alphabet into a table index.




2. [Exercise 14.18] Answer question 1, but use ordered lists. Does your answer depend on the order in which you insert the items?




3. [Exercise 14.25] Give the contents of the hash table that results when you insert items with the keys E A S Y Q U T I O N in that order into an initially empty table of size M = 16 using linear probing. Use the hash function 11k mod M to transform the kth letter of the alphabet into a table index.




4. [Exercise 14.32] Give the contents of the hash table that results when you insert items with the keys E A S Y Q U T I O N in that order into an initially empty table of size M = 16 using double hashing. Use the hash function 11k mod M for the inital probe and the second hash function (k mod 3) + 1 for the search increment (when the key is the kth letter of the alphabet.