Hacker News new | ask | show | jobs
by masklinn 1107 days ago
> Does everything get rehashed into a bigger table?

Usually yes, though it’s also possible to perform gradual resizing that’s less efficient so it’s only used when needed (e.g. real time systems which can’t afford a full resize).

> What are the Performance implications of that?

Same as a vector. That’s why hashmaps generally provide an amortized insertion time.

> What we didn't look at though was, what happens when the hash table is full?

Of note: a hash table never gets full, hash tables have a load factor (which mostly depends on the collision resolution algorithm, as that informs how performances degrade as collisions increase), and the table will resize when it exceeds its load factor, to maintain a “healthy” rate of collisions.