Data Structures and Abstractions With Java™: Frank M. Carrano Timothy M. Henry
Data Structures and Abstractions With Java™: Frank M. Carrano Timothy M. Henry
Data Structures and Abstractions With Java™: Frank M. Carrano Timothy M. Henry
Frank M. Carrano
University of Rhode Island
Timothy M. Henry
New England Institute of Technology
Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this text-
book appear on the appropriate page within text.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Copyright © 2019, 2015, 2012 and 2007 Pearson Education, Inc., All rights reserved. Printed in the United
States of America. This publication is protected by Copyright, and permission should be obtained from the
publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or
by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use
material from this work, please submit a written request to Pearson Education, Inc., Permissions Depart-
ment, 221 River Street, Hoboken, NJ 07030, or you may fax your request to 201-236-3290.
Many of the designations by manufacturers and sellers to distinguish their products are claimed as trade-
marks. Where those designations appear in this book, and the publisher was aware of a trademark claim,
the designations have been printed in initial caps or all caps.
10 9 8 7 6 5 4 3 2 1
Welcome
elcome to the fifth edition of Data Structures and Abstractions with Java, a book for an introduc-
tory course in data structures, typically known as CS-2.
I wrote this book with you in mind—whether you are an instructor or a student—based upon my
experiences during more than three decades of teaching undergraduate computer science. I wanted my
book to be reader friendly so that students could learn more easily and instructors could teach more
effectively. To this end, you will find the material covered in small pieces—I call them “segments”—
that are easy to digest and facilitate learning. Numerous examples that mimic real-world situations
provide a context for the new material and help to make it easier for students to learn and retain
abstract concepts. Many illustrations clarify complicated ideas. Included are over 60 video tutorials
to supplement the instruction and help students when their instructor is unavailable.
I am happy to work again with my colleague and co-author of the fourth edition, Dr. Timothy
Henry. Together we have continued to enhance the presentation with our focus on design decisions
for both specifications and implementations of various data structures, as well as our emphasis on
safe and secure programming practices.
We hope that you enjoy reading this book. Like many others before you, you can learn—or
teach —data structures in an effective and sustainable way.
Warm regards,
Frank M. Carrano
T his book’s organization, sequencing, and pace of topic coverage make teaching and learning
easier by
iii
The following brief table of contents shows the overall composition of the book. Notice the Intro-
duction, Prelude, and nine Java Interludes. Further details—including a chapter-by-chapter descrip-
tion—are given later in this preface.
iv
• Added coverage of recursion in a new chapter that introduces grammars, languages, and
backtracking.
• Continued our introduction to safe and secure programing practices.
• Added additional Design Decisions, Notes, Security Notes, and Programming Tips through-
out the book.
• Added new exercises and programming projects, with an emphasis in areas of gaming,
e-commerce, and finance to most chapters.
• Adjusted the order of some topics.
• Refined our terminology, presentation, and word choices to ease understanding.
• Revised the illustrations to make them easier to read and to understand.
• Renamed Self-Test Questions as Study Questions and moved their answers to online. We
encourage our students to discuss their own answers with a study partner or group.
• Included the appendix about Java classes within the book instead of leaving it online.
• Reduced the amount of Java code given in the book.
• Ensured that all Java code is Java 9 compliant.
Connect with Us
W e are always available to instructors and students who use our books. Your comments, sugges-
tions, and corrections will be greatly appreciated. Please e-mail us at
[email protected] or [email protected]
You can also find us on Twitter, our websites, or Facebook:
• Twitter: twitter.com/makingCSreal
• Websites: www.makingCSreal.com and timothyhenry.net
• Facebook: www.facebook.com/makingCSreal
vi
Pedagogical Elements
Each chapter begins with a table of contents, a list of prerequisite portions of the book that you
should have read, and the learning objectives for the material to be covered. Other pedagogical ele-
ments appear throughout the book, as follows:
Notes Important ideas are presented or summarized in highlighted paragraphs and are
meant to be read in line with the surrounding text.
Security Notes Aspects of safe and secure programming are introduced and highlighted
in this new feature.
A Problem Solved Large examples are presented in the form of “A Problem Solved,” in
which a problem is posed and its solution is discussed, designed, and implemented.
Design Decisions To give readers insight into the design choices that one could make
when formulating a solution, “Design Decision” elements lay out such options, along
with the rationale behind the choice made for a particular example. These discussions
are often in the context of one of the “A Problem Solved” examples.
Study Questions Questions are posed throughout each chapter, integrated within the
text, that reinforce the concept just presented. These “study” questions help readers to
understand the material, since answering them requires pause and reflection. We sug-
gest that you discuss these questions and their answers with others before consulting our
solutions, which are available to you online.
VideoNotes Online tutorials are a Pearson feature that provides video support to the
presentation given throughout the book. They offer students another way to recap and
VideoNote reinforce key concepts. VideoNotes allow for self-paced instruction with easy navigation,
including the ability to select, play, rewind, fast-forward, and stop within each video.
Unique VideoNote icons appear throughout this book whenever a video is available for
a particular concept or problem. A detailed list of the VideoNotes for this text and their
associated locations in the book can be found on page xxiv of this preface. VideoNotes are
free with the purchase of a new textbook. To purchase access to VideoNotes, please go to
pearsonhighered.com/carrano
Exercises and Programming Projects Further practice is available by solving the exercises
and programming projects at the end of each chapter. Unfortunately, we cannot give read-
ers the answers to these exercises and programming projects, even if they are not enrolled
in a class. Only instructors who adopt the book can receive selected answers from the pub-
lisher. For help with these exercises and projects, you will have to contact your instructor.
vii
Instructor Resources
T he following protected material is available to instructors who adopt this book by logging onto
Pearson’s Instructor Resource Center (IRC), accessible from pearsonhighered.com/carrano:
• Instructor’s Guide
• PowerPoint lecture slides that have ADA compatible descriptive text for all images
• Instructor solutions manual
• Lab manual and solutions
• Java source code for instructors
• Figures from the book
• Test bank
Additionally, the resources available to students and described next, are available in the IRC to
instructors.
Please contact your Pearson sales representative for an instructor access code. Contact information
is available at pearsonhighered.com/replocator.
Student Resources
The following material is available to students by logging onto the Companion Website accessible
from pearsonhighered.com/carrano:
• Instructional VideoNotes
• A survey of basic Java (Supplement 1)
• An overview of file I/O (Supplement 2)
• A glossary of terms (Supplement 3)
• Answers to Study Questions (Supplement 4)
Students must use the access card located in the front of the book to register for and then enter the
Companion Website. Students without an access code can purchase access from the Companion Website
by following the instructions listed there.
Note that documentation for the Java Class Library is available at docs.oracle.com/javase/9/
docs/api/.
viii
• Introduction: We begin by setting the stage for the data organizations that we will study by look-
ing at some everyday examples.
• Prelude: The Prelude discusses the design of classes. Among the topics we cover are precon-
ditions, postconditions, assertions, interfaces, and the Unified Modeling language (UML).
Design is an important aspect of our presentation.
• Chapters 1 through 3: We introduce the bag as an abstract data type (ADT). By dividing the
material across several chapters, we clearly separate the specification, use, and implementation
of the bag. For example, Chapter 1 specifies the bag and provides several examples of its use.
This chapter also introduces the ADT set. Chapter 2 covers implementations that use arrays,
while Chapter 3 introduces chains of linked nodes and uses one in the definition of a class of
bags.
In a similar fashion, we separate specification from implementation throughout the book
when we discuss various other ADTs. You can choose to cover the chapters that specify and
use the ADTs and then later cover the chapters that implement them. Or you can cover the
chapters as they appear, implementing each ADT right after studying its specification and use.
A list of chapter prerequisites appears later in this preface to help you plan your path through
the book.
Chapter 2 does more than simply implement the ADT bag. It shows how to approach
the implementation of a class by initially focusing on core methods. When defining a class, it
is often useful to implement and test these core methods first and to leave definitions of the
other methods for later. Chapter 2 also introduces the concept of safe and secure program-
ming, and shows how to add this protection to your code.
• Java Interludes 1 and 2: The first Java interlude introduces generics, so that we can use it with
our first ADT, the bag. This interlude immediately follows Chapter 1. Java Interlude 2 intro-
duces exceptions and follows Chapter 2. We apply this material to the implementations of the
ADT bag.
• Chapter 4: Here we introduce the efficiency and complexity of algorithms, a topic that we inte-
grate into future chapters.
• Chapters 5 and 6: Chapter 5 discusses stacks, giving examples of their use, and Chapter 6
implements the stack using an array, a chain of linked nodes, and a vector.
• Java Interlude 3: This Java interlude shows how the programmer can write new exception
classes. In doing so, it shows how to extend an existing class of exceptions. It also introduces
the finally block.
• Chapters 7 and 8: Chapter 7 discusses queues, deques, and priority queues, and Chap-
ter 8 considers their implementations. It is in this latter chapter that we introduce circu-
larly linked and doubly linked chains. Chapter 8 also uses the programmer-defined class
EmptyQueueException.
• Chapter 9: Next, we present recursion as a problem-solving tool and its relationship to stacks.
Recursion, along with algorithm efficiency, is a topic that is revisited throughout the book.
• Chapters 10, 11, and 12: The next three chapters introduce the ADT list. We discuss this collec-
tion abstractly and then implement it by using an array and a chain of linked nodes.
ix
Acknowledgments
Our sincere appreciation and thanks go to the following reviewers for carefully reading the previous
edition and making candid comments and suggestions that greatly improved the work:
Prakash Duraisamy—Miami University
David Gries—Cornell University
Hakam Alomari—Miami University
Jack Pope—North Hennepin Community College
Anna Rafferty—Carleton College
Special thanks go to our support team at Pearson Education Computer Science during the lengthy
process of revising this book: Executive Portfolio Manager Tracy Johnson, Portfolio Management
Assistant Meghan Jacoby, Managing Content Producer Scott Disanno, and Content Producer Lora
Friedenthal have always be a great help to us in completing our projects. Our long-time copy editor,
Rebecca Pepper, ensured that the presentation is clear, correct, and grammatical. Thank you so much!
Our gratitude for the previously mentioned people does not diminish our appreciation for the
help provided by many others. Tim Henry produced the VideoNotes and the lecture slides for this
edition. Professor Charles Hoot of the Oklahoma City University created the lab manual, Professor
Kathy Liszka from the University of Akron created the collection of test questions, and Joe Erickson
and Jesse Grabowski provided the solutions to many of the programming projects. Thank you again
to the reviewers of the previous editions of the book:
Reviewers for the fourth edition:
Tony Allevato—Virginia Polytechnic Institute and State University
Mary Boelk—Marquette University
Suzanne Buchele—Southwestern University
Kevin Buffardi—Virginia Polytechnic Institute and State University
Jose Cordova—University of Louisiana at Monroe
Greg Gagne—Westminster College
Victoria Hilford—University of Houston
Jim Huggins—Kettering University
Shamim Kahn—Columbus State University
Kathy Liszka—University of Akron
Eli Tilevich—Virginia Polytechnic Institute and State University
Jianhua Yang—Columbus State University
Michelle Zhu—Southern Illinois University
Reviewers for the third edition:
Steven Andrianoff—St. Bonaventure University
Brent Baas—LeTourneau University
Timothy Henry—New England Institute of Technology
Ken Martin—University of North Florida
Bill Siever—Northwest Missouri State University
Lydia Sinapova—Simpson College
Lubomir Stanchev—Indiana University
Judy Walters—North Central College
Xiaohui Yuan—University of North Texas
xi
xii
Table of Contents
Introduction: Organizing Data 1
Prelude: Designing Classes 5
Encapsulation6
Specifying Methods 8
Comments8
Preconditions and Postconditions 9
Assertions10
Java Interfaces 11
Writing a Java Interface 12
Implementing an Interface 13
An Interface as a Data Type 15
Extending an Interface 16
Named Constants Within an Interface 17
Choosing Classes 19
Identifying Classes 20
CRC Cards 21
The Unified Modeling Language 21
Reusing Classes 24
Chapter 1 Bags 29
The Bag 30
A Bag’s Behaviors 30
Specifying a Bag 31
An Interface 37
Using the ADT Bag 39
Using an ADT Is Like Using a Vending Machine 43
The ADT Set 45
Java Class Library: The Interface Set 45
Java Interlude 1 Generics 51
Generic Data Types 51
Generic Types Within an Interface 52
Generic Classes 53
Chapter 2 Bag Implementations That Use Arrays 57
Using a Fixed-Size Array to Implement the ADT Bag 58
An Analogy 58
A Group of Core Methods 59
Implementing the Core Methods 60
Making the Implementation Secure 66
Testing the Core Methods 69
Implementing More Methods 71
Methods That Remove Entries 74
Using Array Resizing to Implement the ADT Bag 82
Resizing an Array 82
A New Implementation of a Bag 85
The Pros and Cons of Using an Array to Implement the ADT Bag 87
Java Interlude 2 Exceptions 93
The Basics 94
Handling an Exception 96
xiii
xiv
Table of Contents
Programmer-Defined Exception Classes 197
Inheritance and Exceptions 201
The finally Block 202
Chapter 7 Queues, Deques, and Priority Queues 205
The ADT Queue 206
A Problem Solved: Simulating a Waiting Line 210
A Problem Solved: Computing the Capital Gain in a Sale of Stock 216
Java Class Library: The Interface Queue219
The ADT Deque 220
A Problem Solved: Computing the Capital Gain in a Sale of Stock 223
Java Class Library: The Interface Deque224
Java Class Library: The Class ArrayDeque225
The ADT Priority Queue 225
A Problem Solved: Tracking Your Assignments 227
Java Class Library: The Class PriorityQueue229
Chapter 8 Queue, Deque, and Priority Queue Implementations 237
A Linked Implementation of a Queue 238
An Array-Based Implementation of a Queue 242
A Circular Array 242
A Circular Array with One Unused Element 245
Circular Linked Implementations of a Queue 251
A Two-Part Circular Linked Chain 251
Java Class Library: The Class AbstractQueue257
A Doubly Linked Implementation of a Deque 257
Possible Implementations of a Priority Queue 261
Chapter 9 Recursion 267
What Is Recursion? 268
Tracing a Recursive Method 272
Recursive Methods That Return a Value 275
Recursively Processing an Array 277
Recursively Processing a Linked Chain 280
The Time Efficiency of Recursive Methods 282
The Time Efficiency of countDown282
The Time Efficiency of Computing xn283
Tail Recursion 284
Using a Stack Instead of Recursion 285
Chapter 10 Lists 295
Specifications for the ADT List 296
Using the ADT List 303
A Problem Solved: Working with Huge Integers 306
Java Class Library: The Interface List308
Java Class Library: The Class ArrayList309
Chapter 11 A List Implementation That Uses an Array 315
Using an Array to Implement the ADT List 316
An Analogy 316
The Java Implementation 318
The Efficiency of Using an Array to Implement the ADT List 326
xv
Table of Contents
Bounded Wildcards 435
Chapter 15 An Introduction to Sorting 437
Organizing Java Methods That Sort an Array 438
Selection Sort 439
Iterative Selection Sort 440
Recursive Selection Sort 442
The Efficiency of Selection Sort 443
Insertion Sort 443
Iterative Insertion Sort 445
Recursive Insertion Sort 447
The Efficiency of Insertion Sort 449
Insertion Sort of a Chain of Linked Nodes 449
Shell Sort 452
The Algorithm 454
The Efficiency of Shell Sort 455
Comparing the Algorithms 455
Chapter 16 Faster Sorting Methods 461
Merge Sort 462
Merging Arrays 462
Recursive Merge Sort 463
The Efficiency of Merge Sort 465
Iterative Merge Sort 467
Merge Sort in the Java Class Library 467
Quick Sort 468
The Efficiency of Quick Sort 468
Creating the Partition 469
Implementing Quick Sort 472
Quick Sort in the Java Class Library 474
Radix Sort 474
Pseudocode for Radix Sort 475
The Efficiency of Radix Sort 476
Comparing the Algorithms 476
Java Interlude 6 Mutable and Immutable Objects 483
Mutable Objects 483
Immutable Objects 485
Creating a Read-Only Class 486
Companion Classes 487
Chapter 17 Sorted Lists 491
Specifications for the ADT Sorted List 492
Using the ADT Sorted List 495
A Linked Implementation 496
The Method add497
The Efficiency of the Linked Implementation 504
An Implementation That Uses the ADT List 504
Efficiency Issues 507
Java Interlude 7 Inheritance and Polymorphism 513
Further Aspects of Inheritance 513
When to Use Inheritance 513
xvii
xviii
Table of Contents
What Is Hashing? 612
Hash Functions 615
Computing Hash Codes 615
Compressing a Hash Code into an Index for the Hash Table 618
Resolving Collisions 619
Open Addressing with Linear Probing 619
Open Addressing with Quadratic Probing 626
Open Addressing with Double Hashing 626
A Potential Problem with Open Addressing 629
Separate Chaining 629
Chapter 23 Hashing as a Dictionary Implementation 637
The Efficiency of Hashing 638
The Load Factor 638
The Cost of Open Addressing 639
The Cost of Separate Chaining 641
Rehashing642
Comparing Schemes for Collision Resolution 643
A Dictionary Implementation That Uses Hashing 644
Entries in the Hash Table 644
Data Fields and Constructors 645
The Methods getValue, remove, and add647
Iterators649
Java Class Library: The Class HashMap650
Java Class Library: The Class HashSet651
Chapter 24 Trees 655
Tree Concepts 656
Hierarchical Organizations 656
Tree Terminology 658
Traversals of a Tree 662
Traversals of a Binary Tree 663
Traversals of a General Tree 665
Java Interfaces for Trees 666
Interfaces for All Trees 666
An Interface for Binary Trees 667
Examples of Binary Trees 668
Expression Trees 669
Decision Trees 670
Binary Search Trees 673
Heaps675
Examples of General Trees 678
Parse Trees 678
Game Trees 678
Chapter 25 Tree Implementations 685
The Nodes in a Binary Tree 686
A Class of Binary Nodes 687
An Implementation of the ADT Binary Tree 688
Creating a Basic Binary Tree 689
The Method initializeTree690
Accessor and Mutator Methods 692
xix
Table of Contents
Adding Entries to a 2-4 Tree 803
Comparing AVL, 2-3, and 2-4 Trees 805
Red-Black Trees 806
Properties of a Red-Black Tree 807
Adding Entries to a Red-Black Tree 808
Java Class Library: The Class TreeMap814
B-Trees814
Chapter 29 Graphs 819
Some Examples and Terminology 820
Road Maps 820
Airline Routes 823
Mazes823
Course Prerequisites 824
Trees824
Traversals825
Breadth-First Traversal 826
Depth-First Traversal 827
Topological Order 829
Paths832
Finding a Path 832
The Shortest Path in an Unweighted Graph 832
The Shortest Path in a Weighted Graph 835
Java Interfaces for the ADT Graph 838
Chapter 30 Graph Implementations 849
An Overview of Two Implementations 850
The Adjacency Matrix 850
The Adjacency List 851
Vertices and Edges 852
Specifying the Class Vertex853
The Inner Class Edge855
Implementing the Class Vertex856
An Implementation of the ADT Graph 859
Basic Operations 859
Graph Algorithms 862
Appendix A Documentation and Programming Style 869
Naming Variables and Classes 869
Indenting870
Comments870
Single-Line Comments 871
Comment Blocks 871
When to Write Comments 871
Java Documentation Comments 871
Appendix B Java Classes 875
Objects and Classes 875
Using the Methods in a Java Class 877
References and Aliases 878
Defining a Java Class 879
Method Definitions 881
xxi
Table of Contents
Enumerations28
Scope30
Loops30
The while Statement 31
The for Statement 32
The do-while Statement 34
Additional Loop Information 35
The Class String36
Characters Within Strings 36
Concatenation of Strings 37
String Methods 38
The Class StringBuilder40
Using Scanner to Extract Pieces of a String 42
Arrays44
Array Parameters and Returned Values 46
Initializing Arrays 47
Array Index Out of Bounds 47
Use of = and == with Arrays 47
Arrays and the For-Each Loop 48
Multidimensional Arrays 49
Wrapper Classes 51
Supplement 2 File Input and Output (online)
Preliminaries2
Why Files? 2
Streams2
The Kinds of Files 3
File Names 3
Text Files 3
Creating a Text File 3
Reading a Text File 8
Changing Existing Data in a Text File 11
Defining a Method to Open a Stream 12
Binary Files 13
Creating a Binary File of Primitive Data 13
Reading a Binary File of Primitive Data 17
Strings in a Binary File 19
Object Serialization 20
Supplement 3 Glossary (online)
Supplement 4 Answers to Study Questions (online)
Index919
xxiii
This table lists the VideoNotes that are available online. The page numbers indi-
VideoNote cate where in the book each VideoNote has relevance.
Chapter 1 Bags 29
Designing an ADT 31
Designing a test for an ADT 39
Java Interlude 1 Generics 51
Generics 52
Chapter 2 Bag Implementations That Use Arrays 57
An array-based bag 59
A resizable bag 85
Java Interlude 2 Exceptions 93
Exceptions 94
Chapter 3 A Bag Implementation That Links Data 103
Linked data 104
Beginning the class LinkedBag 109
Completing the class LinkedBag 115
Chapter 4 The Efficiency of Algorithms 129
Measuring efficiency 131
Comparing ADT bag implementations 143
Chapter 5 Stacks 153
The ADT stack 154
Using the ADT stack 169
Chapter 6 Stack Implementations 181
The Class LinkedStack 182
The Class ArrayStack 185
Java Interlude 3 More About Exceptions 197
Creating your own exceptions 197
Chapter 7 Queues, Deques, and Priority Queues 205
The ADT queue 206
The ADTs deque and priority queue 226
Chapter 8 Queue, Deque, and Priority Queue Implementations 237
The Class LinkedStack 238
The class ArrayQueue 245
Other queue implementations 251
Chapter 9 Recursion 267
Introducing recursion 268
Recursively processing structures 277
Chapter 10 Lists 295
The ADT list 296
Using the ADT list 303
xxiv
VideoNotes
The class AList 319
Completing the class AList 323
Chapter 12 A List Implementation That Links Data 333
The class LList 342
Completing the class LList 348
Java Interlude 4 Iterators 361
Iterators and their use 362
Chapter 13 Iterators for the ADT List 377
Alternative iterator implementations 381
Chapter 14 Problem Solving with Recursion 403
Processing expressions 412
Backtracking 418
Java Interlude 5 More About Generics 429
Generic classes and methods 431
Chapter 15 An Introduction to Sorting 437
Selection sort 439
Insertion sort 444
Chapter 16 Faster Sorting Methods 461
Merge sort 462
Quick sort 468
Java Interlude 6 Mutable and Immutable Objects 483
Mutable and immutable objects 483
Chapter 17 Sorted Lists 491
The class linkedsortedlist 496
An array-based sorted list 504
Java Interlude 7 Inheritance and Polymorphism 513
Inheritance 514
Chapter 18 Inheritance and Lists 525
Inheritance and ADT implementations 526
Creating a base class 533
Chapter 19 Searching 541
Searching an array 542
Searching a linked chain 554
Java Interlude 8 Generics Once Again 563
Multitype generics 563
Chapter 20 Dictionaries 565
The ADT dictionary 566
Using the ADT dictionary 573
Chapter 21 Dictionary Implementations 591
Array-based dictionaries 592
Linked-chain dictionaries 602
Chapter 22 Introducing Hashing 611
Hashing 612
Resolving collisions 619
xxv
xxvi
Prerequisites
Prelude Designing Classes Supplement 1, A, B, C
Chapter 1 Bags Prelude, C
Java Interlude 1 Generics Prelude
Chapter 2 Bag Implementations That Use Arrays Prelude, 1
Java Interlude 2 Exceptions Supplement 1, B, C
Chapter 3 A Bag Implementation That Links Data 1, 2, JI2
Chapter 4 The Efficiency of Algorithms B, 2, 3
Chapter 5 Stacks Prelude, 1, JI2
Chapter 6 Stack Implementations 2, 3, 4, 5
Java Interlude 3 More About Exceptions C, JI2
Chapter 7 Queues, Deques, and Priority Queues Prelude, 5
Chapter 8 Queue, Deque, and Priority Queue Implementations 2, 3, 6, 7
Chapter 9 Recursion B, 2, 3, 4, 5
Chapter 10 Lists Introduction, B, Prelude,
JI2, 6
Chapter 11 A List Implementation That Uses an Array Prelude, 2, 4, 10
Chapter 12 A List Implementation That Links Data 3, 8, 10, 11
Java Interlude 4 Iterators JI2, 10
Chapter 13 Iterators for the ADT List 11, 12, JI4
Chapter 14 Problem Solving with Recursion 5, 9
Java Interlude 5 More About Generics JI1
Chapter 15 An Introduction to Sorting 3, 4, 9, JI5
Chapter 16 Faster Sorting Methods 4, 9, JI5, 15
Java Interlude 6 Mutable and Immutable Objects C, 10
Chapter 17 Sorted Lists 4, 9, 10, 12, JI6
Java Interlude 7 Inheritance and Polymorphism Prelude, C, 6
Chapter 18 Inheritance and Lists C, 10, 11, 12, 17, JI7
Chapter 19 Searching 4, 9, 10, 11, 12, 17
Java Interlude 8 Generics Once Again B, JI5
Chapter 20 Dictionaries 10, JI4, 13, 19, JI8
Chapter 21 Dictionary Implementations 3, 4, 10, 11, 12, JI4, 19, 20