2 ms·
if your hash table is a really good modern open addressed hash table, something like Google's Swiss Tables, you need a really good hash because you will be badl
by tialaramex 4y ago
if your hash table is a really good modern open addressed hash table, something like Google's Swiss Tables, you need a really good hash because you will be badly penalised otherwise, these modern structures demand a hash with proper behaviour for even halfway reasonable performance.
If it's just a My First Hash table with closed addressing, buckets etc. you needn't care too much. If you're hashing integers, just use the integer itself, that's a terrible "hash" but with this like 1980s data structure it's good enough.
- mtlmtlmtlmtl 4y agoA lot of the time if the key is an int however you can get away with an array assuming the range is reasonably small. Worth noting that for AOC I got by just fine with the simplest possible bucket based implementation.