Hash Functions: A Quick Review
Under the hood, a hash table stores its data inside an array or similar structure. However, while an array usually inserts new data at its end, a hash table uses another approach in how it decides where to insert each piece of data. We covered this concept back in Volume 1, but here I’ll remind you of the most pertinent details and then take the discussion further.
To keep things simple, I’ll use examples of inserting integers into the hash table. (You can explore inserting strings, though, in the exercises of this chapter.) Also, although hash tables generally store key-value pairs, I’m going to keep my examples simple by making the key and value the same piece of data. That is, if I say that I’m inserting the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access