java软件结构与数据结_清华大学出版社-图书详情-《Java软件结构与数据结构(第3版)》...

Preface

This book is designed to serve as a text for a course on data structures and

algorithms. This course is typically referred to as the CSZ course because it is often

taken as the second course in a computing curriculum. We have designed this

book to embrace the tenets of Computing Curricula 2001 (CC2001).

Pedagogically, this book follows the style and approach of the leading CSI

book Java Software Solutions: Foundations of Program Design, by John Lewis

and William Loftus. Our book uses many of the highly regarded features of that

book, such as the Key Concept boxes and complete code examples. Together,

these tWo books support a solid and consistent approach to either a tWo-course

or three-course introductory sequence for computing students. That said, this

book does not assume that students have used Java Software Solutions in a

previous course.

Material that might be presented in either course (such as recursion or sorting)

is presented in this book as well. We also include strong reference material

providing an overview of object-oriented concepts and how they are realized in Java.

We understand the crucial role that the data structures and algorithms course

plays in a curriculum and we think this book serves the needs of that course well.

The Third Edition

We have made some key modifications in this third edition to enhance its

pedagogy. The most important change is a fundamental reorganization of material that

is designed to create a cleaner flow of topics. Instead of having an early, large

chapter to review object-oriented concepts, we've included that material as an

appendix for reference. Then we review concepts as needed and appropriate in the

context of the implementation strategies discussed throughout the book and cite

the appropriate reference material. This not only links the topics in a timely

fashion but also demonstrates the usefulness of particular language constructs.

We've expanded the discussion of Analysis of Algorithms, and given it its own

chapter. The discussion, however, stays at an appropriately moderate level. Our

strategy is to motivate the concepts involved in the analysis of algorithms, laying

a solid foundation, rather than get embroiled in too much formality.

Another key organizational change is that the introduction to collections uses

a stack as the primary example. In previous editions of this book we went out of

viI

...

Vlll P R E FAC E

..,,.

our way to introduce collections in an abstract way that separated it from the core

Y to introduce collections in an abstract way that separated it from the core

data structures, using examples such as a bag or set collection. This new approach

.'.'

capltalizes on the fact that a stack is conceDtually about as straightforward as it

ptually about as straightforward as it

T T.

gets. Using it as a first example enhances the understanding of collections as a

I I

whole.

al. l..

foe previous edition of the book had several chanters that focused on farRer

. piers that focused on larger

..''

case studies that made use of collections to solve non-trivial problems. While

.

many instructors found these useful, they also seemed to interrupt the flow of

cove, they also seemed to interrupt the flow of

coverage of core topics. Therefore we have taken the case study chaDters out of the

y chapters out of the

book and Dut them on the web as suDDlementarY resources. We encouraZe all

put them on the web as supplementary resources. We encourage all

..,,,'

Instructors to download and use these resources as they see fit.

J

Finally, for this edition we've reviewed and improved the discussions

throuZhy, ror this edition we've reviewed and improved the discussions

through,', 11TT,,.,'

out the book. We've expanded the discussion of graphs and reversed the order of

.

',,',

the graphs and hashing chapters to make a cleaner flow. And we've added a

chamPs. ~..,'

ter that specifically covers sets and maps.

pecifically covers sets and maps.

We think these modifications build upon the strong pedagogy established by

.'..'.

previous editions and give instructors more opportunity and flexibility to cover

..,

topics as they choose.

'

Our Approach

Books of this type vary greatly in their overall aDDroach. Our aDDroach is founded

y po vary greatly in their overall approach. Our approach is founded

on a few important principles that we fervently embraced. First, we present the

.

., I., I.,,,.

various collections explored in the book in a consistent manned Second, we

.'

,.,.

emDhasize the imDortance of sound software desiZn techniQues. Third, we

organphasize the importance of sound software design techniques. Third, we

organ.,'''.

lied the book to support and reinforce the big picture: the study of data structures

.

rtri J rtlcrorithms. Let's examine these 1.. I C I

and algorithms. Let's examine these principles further

a principles further

Consistent Presentation

When exploring a particular type of collection, we carefully address each of the

ploring a particular type of collection, we carefully address each of the

following issues in order:

1. ConceDt: We discuss the collection conceDtuallv establishing the services it

pt: ac discuss the collection conceptually, establishing the services it

., I..

provides (its interface).

, T T IvT,,'., I' t..

2. Use: We explore examples that illustrate how the particular nature of the

..

I I.'.,.,'.

collection, no matter how it's implemented, can be useful when solving

' I

problems.

3. Implementation: We explore various imDlementation options for the

plementation: We explore various implementation options for the

, I.

collection.

4. Analysis: We comDare and contrast the imDlementations.

J pare and contrast the implementations.

P R E FAC E ix

The Java Collections API is included in the discussion as appropriate. If there

.

is support for a particular collection type in the API, we discuss it and its

imple. ml'' t n.

mentation. rhus we embrace the API, but are not completely tied to it. And we

are not hesitant to joint out its shortcomings.

point out its shortcomings.

The analysis is keDt at a high level. We establish the concept of Big-Oh

notal pt at a high level. We establish the concept of Big-Oh

nota..

non in Chapter 2 and use it throughout the book, but the analysis is more

intu.....'.'

ltlve than it is mathematical.

Sound Program Design

Throughout the book, we keep sound software engineering practices a high

pri.

ority Our design of collection imDlementations and the Drograms that use them

y. Our design of collection implementations and the programs that use them

follow consistent and appropriate standards.

Of primary importance is the separation of a collection's interface from its

underlying implementation. The services that a collection provides are always formally

defined in a Java interface. The interface name is used as the type designation of the

collection whenever appropriate to reinforce the collection as an abstraction.

In addition to practicing solid design principles, we stress them in the

discus. I', 1.

sion throughout the text. We attempt to teach both by example and by continual

snout the text. We attempt to teach both by example and by continual

reinforcement.

Clean Organization

The contents of the book have been carefully organized to minimize distracting

tangents and to reinforce the overall purpose of the book. The organization

supports the book in its role as a pedagogical exploration of data structures and

algorithms as well as its role as a valuable reference.

The book can be divided into numerous parts: Part I consists of the first two

chapters and provides an introduction to the concept of a collection and analysis

of algorithms. Part 11 includes the next four chapters, which cover introductory

and underlying issues that affect all aspects of data structures and algorithms as

ying issues that affect all aspects of data structures and algorithms as

well as linear collections (stacks, queues, and lists). Part ill covers the concepts of

.. t I.,

recursion, sorting, and searching. Part tV covers the nonlinear collections (trees,

heaps, hashing, and graphs). Each type of collection, with the exception of trees,

. I.., ~,.. r I''

is covered in its own chapter Trees are covered in a series of chapters that explore

their various aspects and purposes.

Chapter Breakdown

Chapter 1 (Introduction) discusses various aspects of software quality and

provides an overview of software development issues. It is designed to establish the

x p REFACE

..''

ac n..l gabal' 'hi' ICJ .l'

appropriate mindset before embarking on the details of data structure and

algo.

.',.

rithm design.

Chapter 2 (Analysis of Algorithms) lays the foundation for determining the

I

efficiency of an algorithm and explains the important criteria that allow a

develJ O plains the important criteria that allow a

devel'..'

oper to compare one algorithm to another in proper ways. Our emphasis in this

'

,.,,.'.'..,.,

chapter is understanding the important concepts more than getting mired in heayy

.

'

math or formalitv

y.

Chapter 3 (Collections) establishes the concept of a collection, stressing the

1.

,'.

need to separate the interface from the implementation. It also conceptually

intro'.

duces a stack, then explores an array-based implementation of a stack.

Chapter 4 (Linked Structures) discusses the use of references to create linked

pier 4 (Linked Structures) discusses the use of references to create linked

data structures. It explores the basic issues regarding the management of linked

.

lists, and then defines an alternative implementation of a stack (introduced in

Chapter 3) using an underlying linked data structure.

.

Chapter 5 (Queues) explores the concept and implementation of a first-in,

first.

n'....''

out queue. Radix sort is discussed as an examDle of using queues effectively. The

iueue. Radix sort is discussed as an example of using queues effectively. The

.,. I

implementation options covered include an underlying linked list as well as both

fixed and circular arrays.

Chapter 6 (Lists) covers three types of lists: ordered, unordered, and indexed.

'

al 1 C I. I I I.,,..

fhese three types of lists are comDared and contrasted, with discussion of the

ypes of lists are compared and contrasted, with discussion of the

.'',' t,

operations that they share and those that are unioue to each type. Inheritance is

.

used appropriately in the design of the various types of lists, which are

imple.

'.''..,.

mented using both array-based and linked representations.

Chanter 7 (Recursion) is a general introduction to the concept of recursion and

pier 7 (Recursion) is a general introduction to the concept of recursion and

how recursive solutions can be elegant. It explores the implementation details of

.' I.,,..'

recurslon and discusses the basic idea of analyzing recursive algorithms.

yiing recursive algorithms.

Chapter 8 (Sorting and Searching) discusses the linear and binary search

algo'

.''.,'..

rithms, as well as the algorithms for several sorts: selection sort, insertion sort,

bubble sort, quick sort, and merge sort. Programming issues related to searching

,.'.'

and sorting, such as using the Comparable interface as the basis of comparing

s, .uch as using the Comparable interface as the basis of comparing

I.,.'.,

objects, are stressed in this chapter Searching and sorting that are based in

parjects, are stressed in this chapter Searching and sorting that are based in

par.,,

ticular data structures (such as heap sort) are covered in the appropriate chapter

later in the book.

Chapter 9 (Trees) provides an overview of trees, establishing key terminology

I

, v,.

and concepts. It discusses various implementation approaches and uses a binary

''

.,

tree to represent and evaluate an arithmetic expression.

..

Chapter 10 (Binary Search Trees) builds off of the basic concepts established in

I

Chapter 9 to define a classic binary search tree. A linked implementation of a

'

binary search tree is examined. followed by a discussion of how the balance in the

y search tree is examined, followed by a discussion of how the balance in the

P R E FAC E xl

tree nodes is key to its performance. That leads to exDlorinZ AVL and red/black

y to its performance. That leads to exploring AVL and red/black

.,.

implementations of binary search trees.

Chanter 11 (Priority Queues and Heaps) explores the concept, use, and

implepter 11 (Priority Queues and Heaps) explores the concept, use, and

imple. r,,. ~.. t'

mentations of heaps and specifically their relationship to priority queues. A heap

.

.',

sort is used as an example of its usefulness as well. Both linked and array-based

.

.,..,

implementations are explored.

ChaDter 12 (Multi-way Search Trees) is a natural extension of the discussion of

pier 12 (Multi-way Search Trees) is a natural extension of the discussion of

the previous chapters. The concepts of 2-3 trees, 2-4 trees, and general B-trees are

.

., I.,..'.'

examined and implementation options are discussed.

.

ChaDter 13 (Graphs) explores the concept of undirected and directed graphs

pier 13 (Graphs) explores the concept of undirected and directed graphs

and establishes important terminology. It examines several common graph

algoportant terminology. It examines several common graph

algorithms and discusses imDlementation options. including adiacencv matrices.

plementation options, including adjacency matrices.

Chapter 14 (Hashing) covers the concept of hashing and related issues, such as

.

hash functions and collisions. Various Java Collections API options for hashing

are discussed.

Chapter 15 (Sets and Maps) explores these two types of collections and their

'

.. x

importance to the Java Collections API.

Appendix A (UML) provides an introduction to the Unified Modeling

Language as a reference. UML is the de facto standard notation for representing

presenting

object-oriented systems.

Appendix B (Object-Oriented Design) is a reference for anyone needing a

.

review of fundamental object-oriented concepts and how they are accomplished

j pts and how they are accomplished

in Java. Included are the concepts of abstraction, classes, encapsulation,

inheritance, and polymorphism, as well as many related Java language constructs such

.

.

as Interfaces.

SupplementS

The following supplements are available to all readers of this book at ~aw

.condcssupport.

. Source Code for all Drograms Dresented in the book

programs presented in the book

. Full case studies of programs that illustrate concepts from the text,

includ..

. n'' T I

lug a Black Jack Game, a Calculator, a Family Tree Program, and a Web

Crawler

The following instructor supplements are only available to qualified

instructors at Pearson Education's instructor Resource Center, http://www

.pearsonhighered.condirc. Please visit the Web site, contact your local Pearson

Education Sales Representative, or send an e-mail to computing@Dearson.com.

presentative, or send an e-mail to computing@pearson.com,

for information about how to access them.

..

xll P R EFAC E

R'.

. solutions for selected exercises and programming projects in the book

programming projects in the book

m n'... 1 1 1 t

. fest Bank, containing questions that can be used for exams

n D. @ FI' 1 c i.

. Powerpoint@ Slides for the presentation of the book content

Acknowledgements

First and most importantly we want to thank our students for whom this book is

.,..'.', 1 1, T r t i, I t

written and without whom it never could have been. Your feedback helps us

become better educators and writers. Please continue to keep us on our toes.

We would like to thank all of the reviewers listed below who took the time to

, I... I, I.

share their insight on the content and presentation of the material in this book and

.. t.., 1..' I'

its previous editions. Your input was invaluable.

Mary P. Boelk. Marauette University

;, Marquette University

Robert Burton, Brigham YOung University

Gerald Cohen, St. Joseph's College

Robert Cohen, University of Massachusetts--Boston

Jack Davis, Rad ford University

Bob Holloway, University of Wisconsin--Madison

Y, University of Wisconsin--Madison

Nisar Hundewale, Georgia State University

Chung Lee, California State Polytechnic University

Mark C. Lewis, Trinity University

Mark i. Llewellyn, University of Central Florida

J. Llewellyn, University of Central Florida

Ronald Marsh, University of North Dakota

Eli C. Minkoff, Bates College; University of Maine--Augusta

Ned Okie, Rad ford University

Manuel A. Perez-Quinones, Virginia Tech

Moshe Rosenfeld University of WashinZton

J aLOn

islam Salloum. California State Pollrtechnic Universitir--Pomona

aalam Salloum, California State Polytechnic University--Pomona

Don Slater, Carnegie Mellon University

Ashish Soul, University of Southern California

Carola Wenk, University of Texas--San Antonio

The folks at Addison-Wesley have gone to great lengths to support and

j o great lengths to support and

develop this book along with us. It is a true team effort. Editonin-Chief Michael

Hirsch and his assistant Stephanie Sellinger have always been there to help.

Marketing Manager Erin Davis, her assistant Kathryn Ferranti, and the entire

Addison-Weslev sales force work tirelesslv to make sure that instructors

under; .ales force work tirelessly to make sure that instructors

under,, I I.

stand the goals and benefits of the book. Heather McNally flawlessly handled

'..

the production of the book, and Elena Sidorova is to be credited for the

wonderful cover design. They are supported by Kathy Smith and Harry Druding at

Nesbitt Graphics. Carol Melville always finds a way to get us time on press so

phics. Carol Melville always finds a way to get us time on press so

P R E FAC E xili

that our book makes it into your hands in time to use it in class. Thank you all

your hands in time to use it in class. Thank you all

very much for all YOur hard work and dedication to this book.

' Inuch for all your hard work and dedication to this book.

We'd be remiss if we didn't acknowledge the wonderful contributions of the

ACM Special interest Group on Computer Science Education. Its publications and

. I

conferences are crucial to anyone who takes the pedagogy of computing seriously.

If you're not part of this group, you're missing out.

Finally, we want to thank our families, who support and encourage us in

what;, we want to thank our families, who support and encourage us in

what.

ever prolects we find ourselves diving into. Ultimately, you are the reason we do

.

what we do.

more >

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值