Practice with Hashing
1.
Give the contents of the hash table that results when you insert items
with the keys D E M O C R A T in that order into an initially empty
table of size M = 16 using linear probing. Use the hash
function 11
k mod M to transform the kth letter of the
alphabet into a table index, e.g., hash('C') = hash(3) = 11*3 % 16
= 33 % 16 = 1.
2.Give
the contents of the hash table that results when you insert items with
the keys R E P U B L I C A N in that order into an initially empty
table of size M = 16 using quadratic probing. Use the hash
function 11k mod M to transform the kth letter
of the alphabet into a table index.
3.Give
the contents of the hash table that results when you insert items with
the keys L I B E R T A R I A N in that order into an initially empty
table of size M = 21 using quadratic probing. Use the hash
function 11k mod M to transform the kth letter
of the alphabet into a table index.
3.Give the contents of the hash table that results when you
insert items
with the keys A N O T H E R X M P L in that order into an initially
empty
table of size M = 11 using double hashing. Use the hash
function k mod M for the inital probe and the second
hash function (k mod 3) + 1 for the search increment.