Firstly,
I was sent here from cstheory.stackexchange.com's FAQ, please tell me if this too is the wrong board (this board's FAQ indicates that I have to goto stackoverflow ??)
This is my first question on this board and i am not an algo-person, please feel free to point out any flaws in the question.
Legend::
MY_MAXIMUM: Variable used to indicate the maximum number of rows in a hash table (AKA unique keys in the table).
MAX_COLLISION: Maximum number of collision admissible for a key.
Notes::
Type of hashing scheme used: Open hashing ( Each row contains a (key,value) pair, the value element here is a pointer to a list used to hold a maximum of, MAX_COLLISION elements).
Overflow: when trying to insert into a key already containing MAX_COLLISION number of elements, the new prospective element is quietly dropped, instead of applying another hash algorithm or employing a rehashing algorithm. Hence there is a dear need for uniformity in insertion.
Question::
Function HASH gets an input value, that is hashed using CRC32 and stored in a hash table. I want to reduce this table to have atmost MY_MAXIMUM number of rows with uniform distribution (The number of unique keys should be atmost MY_MAXIMUM).
A simple idea i had:
Function Hash() { key=crc32(input); key=key%MY_MAXIMUM; // use key .. }
This is not necessarily result in uniform load on the resulting table. Also please note that the primary goal is not in limiting key values to be between (0,MY_MAXIMUM), but in limiting the number of unique keys in the table.
So i seek your advice for an appropriate substitute for key=key%MY_MAXIMUM operation.
Thanks,