Yes you will get multiple hash values that re-occur for different strings.
If you are building your own hash table. you may will to look at howto implement skip lists. Or some similar method to overcome this issue. This efftivly lets you have duplicate keys. Which a small performance hit where duplicate keys occurs. If you get a lot of the same duplicate key you then either expend the number of bits in the key and alter how the keys are generated and rebuild the hash table.
This can work really well for a hash implementation that does not know how many keys it is likly to have in the system at design time.
Main Topics
Browse All Topics





by: ladarlingPosted on 2009-09-04 at 08:02:31ID: 25260351
If you have 1 million unique barcodes, then you are very unlikely to encounter this problem. If you have duplicates, you will almost certainly have it.
"But the calculation guarantees that the same string will always produce the same hash value."
That is true so that comparisons can be made.