Quiz

Amortized Cost of Hash Map Insertion

Understand why hash map insertion is O(1) amortized despite occasional expensive resizes.

A hash map with separate chaining doubles its bucket array (and rehashes all entries) whenever the load factor exceeds a threshold. Assuming a good hash function distributing keys uniformly, what is the correct characterization of insertion cost?