4 ms·
That's what I was thinking after reading the rationale, there are plenty of options that don't involve a hash map. That said, linearly scanning is not much dif
by munchbunny 5y ago
That's what I was thinking after reading the rationale, there are plenty of options that don't involve a hash map.
That said, linearly scanning is not much different from a hash map with linear probing that has no empty slots left, so it's not necessarily obvious that the hash map actually takes that much more space.
- usefulcat 5y agoI wouldn't expect a hash map that uses linear probing to wait until it's full (or even nearly full) before increasing the size of the table. Doing a linear scan on a hash table which is both nearly full and very large would be quite bad.
- munchbunny 5y agoNormally I wouldn't expect it either, but if you know it caps out at single-digit numbers of elements, then it's not the worst idea. I'd still just use a plain array, but my point was that hash maps aren't necessarily big and unwieldy.