Chapter 6. Serious Data Structures: Hash Tables, Stacks, and Queues
So far we’ve leaned on arrays and linked lists for our data structures. These are great basics, but they are not always the fastest way to find or organize things. Now we’re going straight to the heavy hitters. You’ll see how a hash table can find things almost instantly, no matter how big the collection gets; how a stack keeps things in last-in-first-out order (like a plate dispenser); and how a queue manages first-in-first-out tasks (like a coffee line). These structures are everywhere in real programs. Once you know them, you’ll start spotting them hidden inside apps, tools, and systems you use every day.
Can Micro-Storage be saved?
Micro-Storage was dominating the industry...until reality hit. Their innovation of optimizing box lookup based on sorting boxes turned into a reshuffling nightmare. Sure, lookups were fast, but updates were painful. And now, with boxes piling up, their competitor, Hash Storage, is taking major market share with its “instant finds at any scale” technology.
Mara: What if we stop sorting altogether?
Sam: Wouldn’t that be nice?
Alex: What if we could skip the search entirely—no scanning, no middle steps—and just jump directly to the right spot?
Sam: Like I said, wouldn’t that be ...
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