4. Stacks and Queues
In This Chapter
In this chapter we’ll examine three data storage structures: the stack, the queue, and the priority queue. We’ll begin by discussing how these structures differ from arrays; then we’ll examine each one in turn. In the last section, we’ll look at an operation in which the stack plays a significant role: parsing arithmetic expressions.
A Different Kind of Structure
There are significant differences between the data structures and algorithms we’ve seen in previous chapters and those we’ll look at now. We’ll discuss three of these differences before we examine the new structures in detail.