I was reading about this person's interview "at a well-known search company".
http://asserttrue.blogspot.com/2009/05/one-of-toughest-job-interview-questions.html
He was asked a question which led to him implementing a hash table. He said the following:
HASH = INITIAL_VALUE;
FOR EACH ( CHAR IN WORD ) {
HASH *= MAGIC_NUMBER
HASH ^= CHAR
HASH %= BOUNDS
}
RETURN HASH
I explained that the hash table array length should be prime, and the BOUNDS number is less than the table length, but coprime to the table length.
Why should the BOUNDS number be less than the number of buckets? What does being coprime to the table length do? Isn't it supposed to be coprime to the BOUNDS?