Lists, Stacks, and Queues
This chapter discusses three of the most simple and basic data structures. Virtually every significant program will use at least one of these structures explicitly, and a stack is always implicitly used in your program, whether or not you declare one. Among the highlights of this chapter, we will
-
Introduce the concept of Abstract Data Types (ADTs).
-
Show how to efficiently perform operations on lists.
-
Introduce the stack ADT and its use in implementing recursion.
-
Introduce the queue ADT and its use in operating systems and algorithm design.
Because these data structures are so important, one might expect that they are hard to implement. In fact, they are extremely easy to code up; the main difficulty is keeping enough discipline to write good general-purpose code for routines that are generally only a few lines long.