Teaches students the modern approach to data structures. Ex.___
Includes an applied study of interesting and classical algorithms that illustrate the data structures using only simple mathematical concepts. (Big-O notation is introduced intuitively). Ex.___
Lead students through the concepts. Ex.___
Book provides students with many examples before presenting the corresponding implementation so that students see a data structure unfold and are then able to trace back through the examples when looking at the implementation. Ex.___
Allows students to understand and use powerful abstractions available in modern data structures. Ex.___
Appropriate material for an advanced data structures and algorithms course. Ex.___
Reflects the type of data structures that students would use in the real world. Ex.___
Helps students learn, review, and retain material. Ex.___
This long-awaited second edition of Data Structures with C++ Using STL, by Professors Ford and Topp, provides a modern object-oriented approach to data structures using the model of the Standard Template Library (STL). The authors unify the study of data structures around the concepts of containers and iterators. The book skillfully develops algorithms for the data structures and their applications. Readers will find a systematic and detailed implementation for each data structure. These successful authors offer a learning tool that is motivated by a wealth of excellent examples and complete running programs.
(Most chapters end with Chapter Summary, Classes and Libraries in the Chapter, Review Exercises, Written Exercises, Programming Exercises and Programming Projects.)
1. Introduction to Data Structures.
What is this Book About? Abstract View of Data Structures. An ADT as a Class. Implementing C++ Classes. Declaring and Using Objects. Implementing a Class with Inline Code. Application Programming Interface(API). Strings.
Software Design. Handling Runtime Errors. Object Composition. Operator Overloading.
Selection Sort. Simple Search Algorithms. Analysis of Algorithms. Analyzing the Search Algorithms. Making Algorithms Generic. The Concept of Recursion. Problem Solving with Recursion.
Overview of STL Container Classes. Template Classes. The Vector Class. Vector Applications.
C++ Pointers. Dynamic Memory. Classes Using Dynamic Memory. Assignment and Initialization. The Minivector Class. The Matrix Class.
The List Container. Iterators. General List Insert And Erase Operations. Case Study: Graduation Lists.
The Stack ADT. Recursive Code and the Runtime Stack. Stack Implementation. Postfix Expressions. Case Study: Infix Expression Evaluation.
The Queue ADT. The Radix Sort. Implementing the Miniqueue Class. Case Study: Time-Driven Simulation. Array Based Queue Implementation. Priority Queues.
Linked List Nodes. Building Linked Lists. Handling The Back of the List. Implementing a Linked Queue. Doubly Linked Lists. Updating A Doubly Linked List. The Josephus Problem. The Minilist Class. Selecting a Sequence Container.
Tree Structures. Binary Tree Nodes. Binary Tree Scan Algorithms. Using Tree Scan Algorithms. Binary Search Trees. Using Binary Search Trees. Implementing the Stree Class. The Stree Iterator (Optional).
Overview of Associative Containers. Sets. Maps. Multisets. Implementing Sets And Maps.
Hashing. Designing Hash Functions. Designing Hash Tables. The Hash Class. Hash Table Performance. 2-3-4 Trees. Red-Black Trees. The Rbtree Class.
Inheritance in C++. The Graphics Hierarchy. The Graphics System. Safe Vectors. Ordered Lists. Polymorphism and Virtual Functions. Abstract Classes.
Array Based Binary Trees. Heaps. Implementing a Priority Queue. Binary Files. Bitsets. Case Study: Huffman Compression.
Divide and Conquer Algorithms. Combinatorics. Dynamic Programming. Backtracking: The Eight-Queens Problem.
Graph Terminology. The Graph Class. Graph Class Design. Graph Traversal Algorithms. Graph Traversal Applications. Graph Minimization Algorithms.
This book is designed to present the fundamentals of data structures from an object-oriented perspective. The focus is on data structures that efficiently store large collections of data. The structures, called containers, feature operations to access, insert, and remove items from the collection. The study of data structures is core to a computer science curriculum. This curriculum has had a rich and storied tradition. Computer researchers and practitioners have evolved a wide range of container structures to meet different problem situations. Initially, the focus was on implementation issues so that programs could efficiently store and access large data sets within the limited physical resources of the computer system. As computers developed greater CPU power and increased memory and storage capabilities, researchers and practitioners were free to give more consideration to the abstract design of the containers. The efforts were greatly aided by an emerging emphasis on object-oriented programming. Object technology provides a means of viewing containers as objects with designated operations to handle the data. A class declaration defines the structure of a container. The public member functions describe a programming interface that allows a container to be used in applications.
Researchers at AT&T Bell Laboratories and Hewlett-Packard Research Labs combined the principles of generic and object-oriented programming to create a unified approach to the study of data structures and algorithms. The result is the Standard Template Library (STL), which is now part of the standard C++ library. STL provides a modern approach to data structures. It categories the structures as sequence and associative containers, along with adapter classes. By using templates rd iterators, the STL library allows a programmer to execute a broad range of algorithms that apply to each of the container classes.
This is, however, not a book on STL. It draws on the design structure of STL to date a unifying study of data structures. The reader will be introduced to the basics of STL and become familiar with the essential elements of the library. The result will be an appreciation of the power, simplicity, and usefulness of STL. With this background, the reader can easily read a technical book on STL to learn more of its many features. While this book is designed as a textbook, a computer professional could use it as a self-study guide to data structures.
This book uses a very careful and systematic approach in the development of each data structure. The reader first views a structure informally as an ADT that provides a description of how the container stores elements. Text, figures, and examples provide a detailed understanding of the key operations for the data structure, without reference to any implementation. The reader is then introduced to a second view of the structure using a formal C++ class declaration or an API. The latter refers to an Application Programming Interface format that is the industry-wide standard for presenting class operations. The API format includes the function prototype, a description of its action, and a listing of its preconditions and postconditions. We use the API format to describe the STL container classes and the class declaration to describe the other data structures that are developed in the book.
Once the reader is familiar with a formal representation of a data structure, the book provides a series of applications, which illustrate problem-solving situations that effectively use the structure. Having the reader understand the implementation of a data structure is a key feature of the book. Corresponding to each STL container class, the book presents a "mini Container" class that uses the STL interface but offers a straight forward implementation of the operations. The text clearly presents the design and coding of the key operations. The supplemental software supplies a complete listing of the class, with well-documented code.
This book assumes the reader has completed a first course in C++ object-oriented programming. The authors assume that the concepts of object composition, operator overloading, pointers and dynamic memory, and inheritance are covered briefly, if at all, in a first course. These concepts are carefully developed in this book in the context of their application to data structures. Periodically the book introduces only the essentials of a programming concept, and makes available a Web Tutorial that develops the concept in greater depth. The tutorials include examples and programs and provide the reader with enrichment that is not critical to understanding the text. The existence of a tutorial is clearly marked with an icon in the margin.
Chapters 1 through 10 cover sequence containers (array, vector, list, deque), the adapter classes (stacks, queues, and priority queues), and an introduction to associative tree containers. The material, along with a development of pointers, dynamic memory, and linked lists contains the topics usually covered in a first course in data structures (CS2).
Chapters 11 through 16 introduce more advanced containers that include sets, maps, balanced trees, heaps, hash tables and graphs. The chapters also include a study of applied searching and sorting algorithms, advanced recursion, and graph algorithms. The material is appropriate for a follow-up course in advanced data structures and applied algorithms (CS7).
Readers may access the complete source code listings for all classes and programs in the book from the authors' website at http://www.uop.edu/fordtopp or http://www.fordtopp.com, and from Prentice Hall at http://www.prenhall.com. The C++ source code has been tested and run in the Windows environment using Microsoft Visual C++ and Borland C++ Builder, and in the UNIX environment using GNU C++. The graphics library is implemented in each of these environments.
To successfully compile and run the programs in the book using the Microsoft Visual C++,6.0 compiler, the reader must install the latest Service Pack. Instructions for obtaining and loading the service pack are available on the authors' and Prentice Hall web sites. The same sites include the Web tutorials and Powerpoint slides that present the key topics from each chapter.
An Instructor's Resource CD (IRCD) is available to instructors and provides answers to all of the written exercises and a solution to all of the programming exercises and programming projects. The IRCD also has sample tests with 'questions in a variety of formats. All of these elements are provided in Word for` mat (".doc") to enable the selection and modification of individual items. For printing only, the IRCD also supplies the materials in Acrobat Reader (".pdf") and postscript (".ps") format. In addition, it provides individual source files of all the programs (*.cpp) and classes (*.h) that are developed in the exercises. The IRCD is available upon request by Professors and Instructors from your local Prentice Hall sales representative.
The authors have been supported by friends, students, and colleagues throughout he preparation of the second edition of Data Structures with C++ using STL. The University of the Pacific has generously provided resources and support to complete the project. Prentice Hall offered a dedicated team of professionals who hand the book design and production. We are especially grateful to our acquisitions editor, Petra Recter and to the production editor, AudriAnna Bazlen. We also appreciate the efforts of Sara Burrows, assistant editor, who worked with us on the compilation of the supplements, and the work of Jennie Burger, who is doing the active marketing of the book.
Students have offered valuable criticism of the manuscript by giving us explicit feedback. Our reviewers offered guidance during the design of the new edition detailed comments on both the content and the pedagogical approach. We took most of their recommendations into account. Thanks go to Carol Roberts, University of Maine; Ken Bosworth, Idaho State University; Ralph Ewton, University of Texas, El Paso. Special thanks go to James Slack at Minnesota State University, Mankato, who made extensive and detailed suggestions. His insights and support were invaluable to the authors and greatly improved the final design and content of the book.