The implementation in Colt is correct, it is double addressing, the
value of the second hash is always relatively prime to the first one
(and must not be zero). The colt's implementation can be rewritten as:

const_increment = 1 + h % (m - 2);

if you do a loop

while (true)
{
  slot = (slot + const_increment) % m;
}

you will eventually iterate all slots between 0...m-1, no matter what
const_increment's value was chosen. As far as I remember, Knuth also
suggests to pick h2 (the second hash function) as a function of the
first hash function, don't have the book with me right now though.

D.

Reply via email to