CART

(0) items

Starting Out with Java : From Control Structures Through Data Structures,9780321545862
This item qualifies for
FREE SHIPPING!

FREE SHIPPING OVER $59!

Your order must be $59 or more, you must select US Postal Service Shipping as your shipping preference, and the "Group my items into as few shipments as possible" option when you place your order.

Bulk sales, PO's, Marketplace Items, eBooks, Apparel, and DVDs not included.

Starting Out with Java : From Control Structures Through Data Structures

by ;
Edition:
2nd
ISBN13:

9780321545862

ISBN10:
0321545869
Format:
Paperback
Pub. Date:
2/21/2011
Publisher(s):
Addison-Wesley
List Price: $157.40

Rent Textbook

(Recommended)
 
Term
Due
Price
$31.48

Buy New Textbook

Currently Available, Usually Ships in 24-48 Hours
N9780321545862
$153.47

eTextbook

Downloadable Offline Access
  • Apple Devices
  • Android Devices
  • Kindle Fire
  • Windows Devices
  • Mac Devices

 
Duration
Price
$70.25

Used Textbook

We're Sorry
Sold Out

More New and Used
from Private Sellers
Starting at $118.15
See Prices

Questions About This Book?

Why should I rent this book?
Renting is easy, fast, and cheap! Renting from eCampus.com can save you hundreds of dollars compared to the cost of new or used books each semester. At the end of the semester, simply ship the book back to us with a free UPS shipping label! No need to worry about selling it back.
How do rental returns work?
Returning books is as easy as possible. As your rental due date approaches, we will email you several courtesy reminders. When you are ready to return, you can print a free UPS shipping label from our website at any time. Then, just return the book to your UPS driver or any staffed UPS location. You can even use the same box we shipped it in!
What version or edition is this?
This is the 2nd edition with a publication date of 2/21/2011.
What is included with this book?
  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any CDs, lab manuals, study guides, etc.
  • The Rental copy of this book is not guaranteed to include any supplemental materials. You may receive a brand new copy, but typically, only the book itself.

Related Products


  • Starting Out with Java : From Control Structures Through Data Structures
    Starting Out with Java : From Control Structures Through Data Structures




Summary

Starting Out with Java: From Control Structures through Data Structures#xA0;is designed to be used#xA0;in a 2 or 3 semester/quarter sequence for beginning programmers.#xA0;Tony Gaddis emphasizes problem-solving and program design by#xA0;teaching the Java programming language#xA0;through a step-by-step detailed presentation. He introduces procedural programming early and covers control structures and methods before objects.#xA0; Students are engaged and have plenty of opportunity to practice using programming concepts through practical tools that include end-of-section and chapter exercises, case studies and programming projects.#xA0; #xA0;

Author Biography

Tony Gaddis is the principal author of the Starting Out With series of textbooks. Tony has nearly 20 years experience teaching computer science courses at Haywood Community College in North Carolina. He is a highly acclaimed instructor who was previously selected as the North Carolina Community College Teacher of the Year and has received the Teaching Excellence award from the National Institute for Staff and Organizational Development. The Starting Out With series includes introductory books using the C++ programming language, the Java™ programming language, Microsoft® Visual Basic®, Microsoft® C#®, Python, Programming Logic and Design, and Alice, all published by the Addison-Wesley imprint of Pearson.

Godfrey Muganda is an Associate Professor of Computer Science at North Central College. He teaches a wide variety of courses at the undergraduate and graduate levels including courses in Linux and Unix programming, Windows and .NET programming, web application development, web services, data structures, and algorithms. He is a past winner of the North Central College faculty award for outstanding scholarship. His primary research interests are in the area of fuzzy sets and systems.

Table of Contents

Preface xvii

Chapter 1 Introduction to Computers and Java 1

1.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Why Program? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.3 Computer Systems: Hardware and Software . . . . . . . . . . . . . . . . . . . . 2

1.4 Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.5 What Is a Program Made of? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

1.6 The Programming Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

1.7 Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Review Questions and Exercises 21

Programming Challenges 25

Chapter 2 Java Fundamentals 27

2.1 The Parts of a Java Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

2.2 The print and println Methods, and the Java API . . . . . . . . . . . . 33

2.3 Variables and Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

2.4 Primitive Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

2.5 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

2.6 Combined Assignment Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

2.7 Conversion between Primitive Data Types . . . . . . . . . . . . . . . . . . . . . 64

2.8 Creating Named Constants with final . . . . . . . . . . . . . . . . . . . . . . 68

2.9 The String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

2.10 Scope. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

2.11 Comments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

2.12 Programming Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

2.13 Reading Keyboard Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

2.14 Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

2.15 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

Review Questions and Exercises 100

Programming Challenges 105

Chapter 3 Decision Structures 109

3.1 The if Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

3.2 The if-else Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

3.3 Nested if Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

3.4 The if-else-if Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

3.5 Logical Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

3.6 Comparing String Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

3.7 More about Variable Declaration and Scope . . . . . . . . . . . . . . . . . . 149

3.8 The Conditional Operator (Optional) . . . . . . . . . . . . . . . . . . . . . . . . 150

3.9 The switch Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

3.10 Creating Objects with the DecimalFormat Class. . . . . . . . . . . . . . 159

3.11 The printf Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

3.12 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

Review Questions and Exercises 169

Programming Challenges 174

Chapter 4 Loops and Files 179

4.1 The Increment and Decrement Operators . . . . . . . . . . . . . . . . . . . . 179

4.2 The while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

4.3 Using the while Loop for Input Validation . . . . . . . . . . . . . . . . . . . 190

4.4 The do-while Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

4.5 The for Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

4.6 Running Totals and Sentinel Values . . . . . . . . . . . . . . . . . . . . . . . . . 206

4.7 Nested Loops. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

4.8 The break and continue Statements (Optional) . . . . . . . . . . . . . 212

4.9 Deciding Which Loop to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

4.10 Introduction to File Input and Output . . . . . . . . . . . . . . . . . . . . . . . 213

4.11 The Random Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

4.12 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

Review Questions and Exercises 236

Programming Challenges 242

Chapter 5 Methods 247

5.1 Introduction to Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

5.2 Passing Arguments to a Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

5.3 More about Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

5.4 Returning a Value from a Method . . . . . . . . . . . . . . . . . . . . . . . . . . 271

5.5 Problem Solving with Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

5.6 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

Review Questions and Exercises 285

Programming Challenges 289

Chapter 6 A First Look at Classes 297

6.1 Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297

6.2 Instance Fields and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

6.3 Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

6.4 Overloading Methods and Constructors. . . . . . . . . . . . . . . . . . . . . . 334

6.5 Scope of Instance Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342

6.6 Packages and import Statements . . . . . . . . . . . . . . . . . . . . . . . . . . 343

6.7 Focus on Object-Oriented Design: Finding the Classes

and Their Responsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

6.8 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352

Review Questions and Exercises 352

Programming Challenges 357

Chapter 7 A First Look at GUI Applications 363

7.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

7.2 Creating Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366

7.3 Equipping GUI Classes with a main Method . . . . . . . . . . . . . . . . . . 394

7.4 Layout Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396

7.5 Radio Buttons and Check Boxes. . . . . . . . . . . . . . . . . . . . . . . . . . . . 412

7.6 Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423

7.7 Focus on Problem Solving: Extending Classes from JPanel . . . . . . 426

7.8 Splash Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438

7.9 Using Console Output to Debug a GUI Application . . . . . . . . . . . . . 439

7.10 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444

Review Questions and Exercises 444

Programming Challenges 448

Chapter 8 Arrays and the ArrayList Class 451

8.1 Introduction to Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451

8.2 Processing Array Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461

8.3 Passing Arrays as Arguments to Methods. . . . . . . . . . . . . . . . . . . . . 470

8.4 Some Useful Array Algorithms and Operations. . . . . . . . . . . . . . . . . 474

8.5 Returning Arrays from Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487

8.6 String Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489

8.7 Arrays of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492

8.8 The Sequential Search Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 495

8.9 Two-Dimensional Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498

8.10 Arrays with Three or More Dimensions . . . . . . . . . . . . . . . . . . . . . . 510

8.11 Command-Line Arguments and Variable-Length Argument Lists . . . 511

8.12 The ArrayList Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515

8.13 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523

Review Questions and Exercises 523

Programming Challenges 528

Chapter 9 A Second Look at Classes and Objects 533

9.1 Static Class Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

9.2 Passing Objects as Arguments to Methods. . . . . . . . . . . . . . . . . . . . 540

9.3 Returning Objects from Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . 543

9.4 The toString Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545

9.5 Writing an equals Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549

9.6 Methods That Copy Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552

9.7 Aggregation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555

9.8 The this Reference Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568

9.9 Enumerated Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571

9.10 Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580

9.11 Focus on Object-Oriented Design: Class Collaboration . . . . . . . . . . 582

9.12 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586

Review Questions and Exercises 587

Programming Challenges 591

Chapter 10 Text Processing and More about Wrapper Classes 597

10.1 Introduction to Wrapper Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . 597

10.2 Character Testing and Conversion with the Character Class. . . . . 598

10.3 More String Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606

10.4 The StringBuilder Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620

10.5 Tokenizing Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628

10.6 Wrapper Classes for the Numeric Data Types. . . . . . . . . . . . . . . . . . 636

10.7 Focus on Problem Solving: The TestScoreReader Class. . . . . . . . 639

10.8 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643

Review Questions and Exercises 643

Programming Challenges 647

Chapter 11 Inheritance 653

11.1 What Is Inheritance? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653

11.2 Calling the Superclass Constructor . . . . . . . . . . . . . . . . . . . . . . . . . 666

11.3 Overriding Superclass Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674

11.4 Protected Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683

11.5 Chains of Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689

11.6 The Object Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695

11.7 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697

11.8 Abstract Classes and Abstract Methods . . . . . . . . . . . . . . . . . . . . . . 702

11.9 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709

11.10 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721

Review Questions and Exercises 722

Programming Challenges 727

Chapter 12 Exceptions and Advanced File I/O 733

12.1 Handling Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733

12.2 Throwing Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755

12.3 Advanced Topics: Binary Files, Random Access Files,

and Object Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761

12.4 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778

Review Questions and Exercises 778

Programming Challenges 784

Chapter 13 Advanced GUI Applications 787

13.1 The Swing and AWT Class Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . 787

13.2 Read-Only Text Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788

13.3 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790

13.4 Combo Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806

13.5 Displaying Images in Labels and Buttons . . . . . . . . . . . . . . . . . . . . . 812

13.6 Mnemonics and Tool Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818

13.7 File Choosers and Color Choosers . . . . . . . . . . . . . . . . . . . . . . . . . . 820

13.8 Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824

13.9 More about Text Components: Text Areas and Fonts. . . . . . . . . . . . 833

13.10 Sliders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837

13.11 Look and Feel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842

13.12 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844

Review Questions and Exercises 845

Programming Challenges 850

Chapter 14 Applets and More 855

14.1 Introduction to Applets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855

14.2 A Brief Introduction to HTML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857

14.3 Creating Applets with Swing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 866

14.4 Using AWT for Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875

14.5 Drawing Shapes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880

14.6 Handling Mouse Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 901

14.7 Timer Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 911

14.8 Playing Audio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915

14.9 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920

Review Questions and Exercises 920

Programming Challenges 927

Chapter 15 Recursion 929

15.1 Introduction to Recursion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929

15.2 Solving Problems with Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . 932

15.3 Examples of Recursive Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937

15.4 The Towers of Hanoi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943

15.5 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947

Review Questions and Exercises 948

Programming Challenges 951

Chapter 16 Sorting, Searching, and Algorithm Analysis 953

16.1 Introduction to Sorting Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . 953

16.2 Introduction to Search Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . 978

16.3 Analysis of Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 989

16.4 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998

Review Questions and Exercises 999

Programming Challenges 1002

Chapter 17 Generics 1005

17.1 Introduction to Generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1005

17.2 Writing a Generic Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008

17.3 Passing Objects of a Generic Class to a Method. . . . . . . . . . . . . . . 1016

17.4 Writing Generic Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1022

17.5 Constraining a Type Parameter in a Generic Class . . . . . . . . . . . . . 1023

17.6 Inheritance and Generic Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . 1026

17.7 Defining Multiple Type Parameters . . . . . . . . . . . . . . . . . . . . . . . . 1030

17.8 Generics and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1033

17.9 Erasure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1039

17.10 Restrictions on the Use of Generic Types . . . . . . . . . . . . . . . . . . . . 1042

17.11 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1044

Review Questions and Exercises 1045

Programming Challenges 1048

Chapter 18 Collections 1051

18.1 Introduction to the Java Collections Framework. . . . . . . . . . . . . . . 1051

18.2 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057

18.3 Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077

18.4 Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1094

18.5 The Collections Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109

18.6 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1112

Review Questions and Exercises 1113

Programming Challenges 1117

Chapter 19 Array-Based Lists 1119

19.1 Introduction to Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119

19.2 Creating an Array-Based List to Hold String Objects . . . . . . . . . . 1120

19.3 Creating a Generic Array-Based List . . . . . . . . . . . . . . . . . . . . . . . . 1141

19.4 Writing Iterator Classes and Iterable Lists . . . . . . . . . . . . . . . . . . . . 1156

Review Questions and Exercises 1164

Programming Challenges 1166

Chapter 20 Linked Lists 1169

20.1 Introduction to Linked Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1169

20.2 Operations on Linked Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1176

20.3 Doubly-Linked and Circularly-Linked Lists . . . . . . . . . . . . . . . . . . . 1188

20.4 Recursion on Linked Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1197

20.5 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1212

Review Questions and Exercises 1212

Programming Challenges 1215

Chapter 21 Stacks and Queues 1219

21.1 Stacks and Their Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1219

21.2 Array Implementation of Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . 1222

21.3 Linked Implementation of Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . 1228

21.4 Queues and Their Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1233

21.5 Array Implementation of Queues . . . . . . . . . . . . . . . . . . . . . . . . . . 1233

21.6 Linked List Implementation of Queues . . . . . . . . . . . . . . . . . . . . . . 1244

21.7 Generic Implementation of Stacks and Queues . . . . . . . . . . . . . . . 1249

21.8 Queues and Breadth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . 1252

21.9 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1255

Review Questions and Exercises 1256

Programming Challenges 1258

Chapter 22 Binary Trees, AVL Trees, and Priority Queues 1261

22.1 Binary Trees and Their Applications . . . . . . . . . . . . . . . . . . . . . . . . 1261

22.2 Binary Search Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1271

22.3 AVL Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1288

22.4 Priority Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1301

22.5 Common Errors to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1318

Review Questions and Exercises 1318

Programming Challenges 1321

Index 1325

 

Appendix A: ASCII/Unicode Characters

Appendix B: Operator Precedence and Associativity

Appendix C: Java Key Words

Appendix D: Installing the JDK and JDK Documentation

Appendix E: Using the javadoc Utility

Appendix F: More about the math Class

Appendix G: Packages

Appendix H: Working with Records and Random Access Files

Appendix I: More about JOptionPane Dialog Boxes

Appendix J: Answers to Checkpoints

Appendix K: Answers to Odd-Numbered Review Questions

 



Please wait while the item is added to your cart...