Book contents
- Frontmatter
- Contents
- Preface
- PART ONE FOUNDATIONS
- PART TWO DATA STRUCTURES
- 9 Abstract Data Types
- 10 Containers as Abstract Data Types
- 11 Stack and Queue
- 12 Application of Stack
- 13 Lists
- 14 Trees, Heaps, and Priority Queues
- 15 Search Trees
- 16 Hashing and Sets
- 17 Association and Dictionary
- 18 Sorting
- Appendix A Unified Modeling Language Notation
- Appendix B Complexity of Algorithms
- Appendix C Installing and Using Foundations Classes
- Index
13 - Lists
from PART TWO - DATA STRUCTURES
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- Preface
- PART ONE FOUNDATIONS
- PART TWO DATA STRUCTURES
- 9 Abstract Data Types
- 10 Containers as Abstract Data Types
- 11 Stack and Queue
- 12 Application of Stack
- 13 Lists
- 14 Trees, Heaps, and Priority Queues
- 15 Search Trees
- 16 Hashing and Sets
- 17 Association and Dictionary
- 18 Sorting
- Appendix A Unified Modeling Language Notation
- Appendix B Complexity of Algorithms
- Appendix C Installing and Using Foundations Classes
- Index
Summary
A list is a widely used container abstraction. Lists come in various flavors, so we really have a family of list abstractions. In real life, lists are used to hold information stored in a particular sequence. This information may be ordered as in a telephone directory or unordered as in a grocery shopping list.
Some lists allow items to be stored in any order whereas others require a sequential ordering of their data. The simplest list allows the addition of objects, removal of objects, and access to objects only at two ends, front and rear. An “indexable” list extends a simple list by allowing the insertion of objects, removal of objects, and access of objects at a particular index. A “positionable” list extends a simple list by allowing the addition of objects, removal of objects, and access to objects before or after a specified object in the list. Finally, an “ordered” list extends SearchTable (see Chapter 10) and requires that its elements be comparable. A strict ordering relationship is maintained among the elements of an ordered list. This is true in a search table.
Lists may be implemented in many ways, both fixed and dynamic. Perhaps the simplest implementation is a singly linked dynamic implementation. Here links flow in only one direction: from the start of the list to its end. One may move quite easily in a singly linked list from a given node to its successor but not to its predecessor.
- Type
- Chapter
- Information
- Fundamentals of OOP and Data Structures in Java , pp. 227 - 262Publisher: Cambridge University PressPrint publication year: 2000