| RadMabbit (8) | |
|
Hey Guys Have an issue with a hashing problem, but there is one major concept that is beating me, how to write the function! I am trying to setup a hash function which takes distinct integer keys and a single letter e.g. {A,B,C,...} etc. The range is to be 2,000,000,000. I am not exactly sure about how to go about writing this code exactly. Thanks for any help p.s. I am using namespace std and the type of data i am given looks like this 2;A , 12001;G etc | |
|
Last edited on
|
|
| codewalker (159) | |
| Post the code that you have so far using code tag. | |
|
|
|
| JLBorges (1336) | |||
|
One possibility is to hash "12001;G" etc as a string. Somewhat more efficient would be to construct a numeric value from the int and the char and then hash that number. For example:
| |||
|
|
|||