Hash Map With Separate Chaining

Asked at Goldman Sachs · Coding Questions · Difficulty: Medium · Last asked Nov 21, 2024

Hash maps give average `O(1)` insert, lookup and delete, but only while keys spread evenly over the buckets. When two different keys land in the same bucket, that is a hash collision, and the map has to keep both keys apart. In this question you build a small hash map that resolves collisions by separate chaining and grows itself before the chains get long.

Loading the problem…