需积分: 10 73 浏览量 更新于2023-05-21 评论 收藏 14.81MB PDF 举报
Data Structures and Algorithms in Java
Michael T. Goodrich
Department of Computer Science University of California, Irvine
Department of Computer Science Brown University
John Wiley & Sons, Inc.
ASSOCIATE PUBLISHER Dan Sayre
MARKETING DIRECTOR Frank Lyman
EDITORIAL ASSISTANT Bridget Morrisey
SENIOR PRODUCTION EDITOR Ken Santor
COVER DESIGNER Hope Miller
COVER PHOTO RESEARCHER Lisa Gee
COVER PHOTO Ralph A.
This book was set in by the authors and printed and bound by R.R. Donnelley
- Crawfordsville. The cover was printed by Phoenix Color, Inc.
To Karen, Paul, Anna, and Jack
-Michael T. Goodrich
Preface to the Fourth Edition
This fourth edition is designed to provide an introduction to data structures and
algorithms, including their design, analysis, and implementation. In terms of curricula
based on the IEEE/ACM 2001 Computing Curriculum, this book is appropriate for
use in the courses CS102 (I/O/B versions), CS103 (I/O/B versions), CS111 (A
version), and CS112 (A/I/O/F/H versions). We discuss its use for such courses in
more detail later in this preface.
The major changes, with respect to the third edition, are the following:
• Added new chapter on arrays, linked lists, and recursion.
• Added new chapter on memory management.
• Full integration with Java 5.0.
• Better integration with the Java Collections Framework.
• Better coverage of iterators.
• Increased coverage of array lists, including the replacement of uses of the class
java.util.Vector with java.util.ArrayList.
• Update of all Java APIs to use generic types.
• Simplified list, binary tree, and priority queue ADTs.
• Further streamlining of mathematics to the seven most used functions.
• Expanded and revised exercises, bringing the total number of reinforcement,
creativity, and project exercises to 670. Added exercises include new projects on
maintaining a game's high-score list, evaluating postfix and infix expressions,
minimax game-tree evaluation, processing stock buy and sell orders, scheduling
CPU jobs, n-body simulation, computing DNA-strand edit distance, and creating
and solving mazes.
This book is related to the following books:
• M.T. Goodrich, R. Tamassia, and D.M. Mount, Data Structures and Algorithms
in C++, John Wiley & Sons, Inc., 2004. This book has a similar overall structure to
the present book, but uses C++ as the underlying language (with some modest, but
necessary pedagogical differences required by this approach). Thus, it could make
for a handy companion book in a curriculum that allows for either a Java or C++
track in the introductory courses.
• M.T. Goodrich and R. Tamassia, Algorithm Design: Foundations, Analysis, and
Internet Examples, John Wiley & Sons, Inc., 2002. This is a textbook for a more
advanced algorithms and data structures course, such as CS210 (T/W/C/S versions)
in the IEEE/ACM 2001 curriculum.
Use as a Textbook
The design and analysis of efficient data structures has long been recognized as a
vital subject in computing, for the study of data structures is part of the core of
every collegiate computer science and computer engineering major program we are
familiar with. Typically, the introductory courses are presented as a two- or three-
course sequence. Elementary data structures are often briefly introduced in the first
programming or introduction to computer science course and this is followed by a
more in-depth introduction to data structures in the following course(s).
Furthermore, this course sequence is typically followed at a later point in the
curriculum by a more in-depth study of data structures and algorithms. We feel that
the central role of data structure design and analysis in the curriculum is fully
justified, given the importance of efficient data structures in most software systems,
including the Web, operating systems, databases, compilers, and scientific
With the emergence of the object-oriented paradigm as the framework of choice for
building robust and reusable software, we have tried to take a consistent
objectoriented viewpoint throughout this text. One of the main ideas of the object-
oriented approach is that data should be presented as being encapsulated with the
methods that access and modify them. That is, rather than simply viewing data as a
collection of bytes and addresses, we think of data as instances of an abstract data
type (ADT) that include a repertory of methods for performing operations on the
data. Likewise, object-oriented solutions are often organized utilizing common
design patterns, which facilitate software reuse and robustness. Thus, we present
each data structure using ADTs and their respective implementations and we
introduce important design patterns as means to organize those implementations
into classes, methods, and objects.
For each ADT presented in this book, we provide an associated Java interface.
Also, concrete data structures realizing the ADTs are provided as Java classes
implementing the interfaces above. We also give Java implementations of
fundamental algorithms (such as sorting and graph traversals) and of sample
applications of data structures (such as HTML tag matching and a photo album).
Due to space limitations, we sometimes show only code fragments in the book and
make additional source code available on the companion Web site,
The Java code implementing fundamental data structures in this book is organized
in a single Java package, net.datastructures. This package forms a coherent library
of data structures and algorithms in Java specifically designed for educational
purposes in a way that is complementary with the Java Collections Framework.
Web Added-Value Education
This book is accompanied by an extensive Web site:
Students are encouraged to use this site along with the book, to help with exercises
and increase understanding of the subject. Instructors are likewise welcome to use
the site to help plan, organize, and present their course materials.
For the Student
for all readers, and specifically for students, we include:
• All the Java source code presented in this book.
• The student version of the net.datastructures package.
• Slide handouts (four-per-page) in PDF format.
• A database of hints to all exercises, indexed by problem number.
• Java animations and interactive applets for data structures and algorithms.
• Hyperlinks to other data structures and algorithms resources.
We feel that the Java animations and interactive applets should be of particular
interest, since they allow readers to interactively "play" with different data
structures, which leads to better understanding of the different ADTs. In addition,
the hints should be of considerable use to anyone needing a little help getting
started on certain exercises.
For the Instructor
For instructors using this book, we include the following additional teaching aids:
• Solutions to over two hundred of the book's exercises.
• A keyword-searchable database of additional exercises.
• The complete net.datastructures package.
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额