Close
Register
Close Window

Show Source |    | About   «  4.14. Algorithm Analysis Summary Exercises   ::   Contents   ::   5.2. The List ADT  »

5.1. Chapter Introduction: Lists

If your program needs to store a few things—numbers, payroll records, or job descriptions for example—the simplest and most effective approach might be to put them in a list. Only when you have to organize and search through a large number of things do more sophisticated data structures like search trees become necessary. Many applications don’t require any form of search, and they do not require that an ordering be placed on the objects being stored. Some applications require that actions be performed in a strict chronological order, processing objects in the order that they arrived, or perhaps processing objects in the reverse of the order that they arrived. For all these situations, a simple list structure is appropriate.

This chapter describes representations both for lists and for two important list-like structures called the stack and the queue. Along with presenting these fundamental data structures, the other goals of the chapter are to:

  1. Give examples that show the separation of a logical representation in the form of an ADT from a physical implementation as a data structure.

  2. Illustrate the use of asymptotic analysis in the context of simple operations that you might already be familiar with. In this way you can begin to see how asymptotic analysis works, without the complications that arise when analyzing more sophisticated algorithms and data structures.

We begin by defining an ADT for lists. Two implementations for the list ADT—the array-based list and the linked list—are covered in detail and their relative merits discussed. The chapter finishes with implementations for stacks and queues.

   «  4.14. Algorithm Analysis Summary Exercises   ::   Contents   ::   5.2. The List ADT  »

nsf
Close Window