close to perfect. But how?</p>
<h3 id="the-peak-memory-usage-solution">The peak memory usage solution</h3>
<p>Suddenly, it hit me. I had a solution. I would create a hash table that internally is made of an array of 16 hash tables (the submaps). When inserting or looking up an item, the index of the target submap would be decided by the hash of the value to insert. For example, if for a given <code>size_t hashval</code>, the index for the internal submap would be computed with:</p>
<p><code>submap_index = (