I'm trying to understand hashing in the context of std::unordered_set
. Cppreference gives this explanation:
Internally, the elements are not sorted in any particular order, but organized into buckets. Which bucket an element is placed into depends entirely on the hash of its value. This allows fast access to individual elements, since once a hash is computed, it refers to the exact bucket the element is placed into.
My problem is that I cannot understand what it looks like in memory. Perhaps this question should address hash tables in general, but this may have too much dependence on implementation as all the explanations of hash tables I managed to find were abstract.
As far as I can guess, buckets are dynamically allocated contiguous pieces of memory, something like arrays, but they are not necessarily contiguous relative to each other, whereas hashes are something like pointers to these arrays stored contiguously.
Am I correct on this?