NAMES:

LOGINS:

PRECEPT:

COS 226 Exercises on Hashing

1. [Exercise 14.17] Give the contents of the hash table that results when you insert the following keys in that order into an initially empty table of M = 5 lists, using separate chaining with unordered lists. Use the hash function 11k mod M to transform the kth letter of the alphabet into a table index, e.g., hash(I) = hash(9) = 99 % 5 = 4.
D E M O C R A T S















2. [Exercise 14.25] Give the contents of the hash table that results when you insert the following keys 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.

R E P U B L I C A N S