Originally Posted by
Daved
>> so if you stored both of those numbers you'd run into trouble.
Not really. That's just a collision. You run into trouble if you have too many collisions, and too many collisions is a sign of a bad hash function (or a hash table that is too small).
When storing something in a hash table, you store the actual value in the table. So you don't have to go from 44 to 99998, you just look at the value(s) listed at index 44 and see what they are.
It's not necessarily a good idea to use a hash function that you can reverse, since that kind of defeats the purpose. A hash table takes a large range of possible values and converts them to a smaller range.