NAMES:
LOGINS:
PRECEPT:
COS 226 Exercises on Hashing
References: Lecture 10 and Section 4.4 in Algs4
1.
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.
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