8 Stacks: Piling up data before processing it
In this chapter
- introducing the stack abstract data type
- applying the LIFO policy in the real world and in computer science
- implementing a stack with arrays and linked lists
- why do we need stacks
In the previous chapter, you familiarized yourself with containers, a class of data structures whose main purpose is to hold a collection of objects, and with the simplest of all containers—the bag. Bags are simple data structures that require few resources. They can be useful when we want to hold data on which we only need to compute some statistics, but overall, they aren’t widely used.
Now it’s time to look at containers that are crucial to computer science: we start with the stack. You’ll find stacks ...
Get Grokking Data Structures now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.