Guys, I have a data structure which has 25 distinct keys (integer) and a value. I have a list of these objects (say 50000) and I intend to use a hash table to store/retrieve them. I am planning to take one of these approaches.
Create a integer hash from these 25 integer keys and store it on a hash table. (Yeah! I have some means to handle collisions)
Make a string concatenation on the individual keys and use it as a hash key for the hash table. For example, if the key values are 1,2,4,6,7 then the hash key would be "12467".
Assuming that I have a total of 50000 records each with 25 distinct keys and a value, then will my second approach be a overkill when it comes to the cost of string comparisons it needs to do to retrieve and insert a record?
Some more information!
- Each bucket in the hash table is a balanced binary tree.
- I am using the boost library's hash_combine method to create the hash from the 25 keys.