Good Hash Tables & Multiple Hash Functions
by Michael Mitzenmacher

Listing One
index1 = hash1(key);  // hash1 returns a number from [0,m - 1]
index2 = hash2(key);  // hash2 returns a number from [0,m - 1]
if (count_keys(index1) < count_keys(index2))
        place key in bucket for index1
        increment count_keys(index1)
else 
        place key in bucket for index2
        increment count_keys(index2)

Listing Two
index1 = hash1(key);  // hash1 returns a number from [0,m/2 - 1]
index2 = m/2 + hash2(key);  // hash2 returns a number from [0,m/2 - 1]
if (count_keys(index1) < count_keys(index2))

   place key in bucket for index1
    increment count_keys(index1)
else 
    place key in bucket for index2
    increment count_keys(index2)


1

