Java Software Structures: Designing and Using Data Structures

Java Software Structures: Designing and Using Data Structures, 4th edition

  • John Lewis, 
  • Joseph Chase

Choose the option that's right for you

Single

$9.99 / mo

4-month minimum term for $39.96

  • Access this eText title
  • Up to 2 devices

Multi

$14.99 / mo

4-month minimum term for $59.96

  • Access over 1,500 titles
  • Up to 2 devices
  • Discounted tutor access

Learn more, spend less

  • Icon

    Study smarter, not harder

    Save time with study tools in your eText

  • Icon

    Listen on the go

    Learn how you like with full eText audio

  • Icon

    Learn anytime, anywhere

    Get the app to access your eText whenever you need it

  • Icon

    Make it your own

    Your notes. Your highlights. Your eText

  • Icon

    Find it fast

    Quickly navigate your eText with search

Overview

Java Software Structures takes a three-pronged approach to introducing data structures — conceptualization, explanation and implementation. With the help of case studies and tutorials, you'll learn to develop high-quality software systems using well-designed collections and algorithms.

Published by Pearson (July 14th 2021) - Copyright © 2014

ISBN-13: 9780137618019

Subject: Pre-Programming & Introduction to Programming

Category: Java

Table of contents

1. Introduction
1.1 Software Quality 2
Correctness 3
Reliability 3
Robustness 4
Usability 4
Maintainability 5
Reusability 5
Portability 6
Efficiency 6
Quality Issues 6
1.2 Data Structures 7
A Physical Example 7
Containers as Objects 10

2. Analysis of Algorithms
2.1 Algorithm Efficiency 16
2.2 Growth Functions and Big-Oh Notation 17
2.3 Comparing Growth Functions 19
2.4 Determining Time Complexity 22
Analyzing Loop Execution 22
Nested Loops 22
Method Calls 23

3. Introduction to Collections - Stacks
3.1 Collections 30
Abstract Data Types 31
The Java Collections API 33
3.2 A Stack Collection 33
3.3 Crucial OO Concepts 35
Inheritance and Polymorphism 36
Generics 37
3.4 Using Stacks: Evaluating Postfix Expressions 38
Javadoc 45
3.5 Exceptions 46
3.6 A Stack ADT 48
3.7 Implementing a Stack: With Arrays 51
Managing Capacity 52
3.8 The ArrayStack Class 53
The Constructors 54
The push Operation 56
The pop Operation 57
The peek Operation 59
Other Operations 59
The EmptyCollectionException Class 59
Other Implementations 60

4. Linked Structures - Stacks
4.1 R eferences as Links 68
4.2 Managing Linked Lists 70
Accessing Elements 70
Inserting Nodes 71
Deleting Nodes 72
4.3 Elements without Links 73
Doubly Linked Lists 73
4.4 Stacks in the Java API 74
4.5 Using Stacks: Traversing a Maze 75
4.6 Implementing a Stack: With Links 84
The LinkedStack Class 84
The push Operation 88
The pop Operation 90
Other Operations 91

5. Queues
5.1 A Conceptual Queue 98
5.2 Queues in the Java API 99
5.3 Using Queues: Code Keys 100
5.4 Using Queues: Ticket Counter Simulation 104
5.5 A Queue ADT 109
5.6 A Linked Implementation of a Queue 111
The enqueue Operation 113
The dequeue Operation 115
Other Operations 116
5.7 Implementing Queues: With Arrays 117
The enqueue Operation 121
The dequeue Operation 123
Other Operations 124
5.8 Double-Ended Queues (Deque) 124

6. Lists
6.1 A List Collection 130
6.2 Lists in the Java Collections API 132
6.3 Using Unordered Lists: Program of Study 133
6.4 Using Indexed Lists: Josephus 144
6.5 A List ADT 146
Adding Elements to a List 147
6.6 Implementing Lists with Arrays 152
The remove Operation 154
The contains Operation 156
The add Operation for an Ordered List 157
Operations Particular to Unordered Lists 159
The addAfter Operation for an Unordered List 159
6.7 Implementing Lists with Links 160
The remove Operation 161

7. Iterators
7.1 What's an Iterator? 170
Other Iterator Issues 172
7.2 Using Iterators: Program of Study Revisited 172
Printing Certain Courses 176
Removing Courses 177
7.3 Implementing Iterators: With Arrays 179
7.4 Implementing Iterators: With Links 181

8. Recursion
8.1 Recursive Thinking 188
Infinite Recursion 188
Recursion in Math 189
8.2 Recursive Programming 190
Recursion versus Iteration 193
Direct versus Indirect Recursion 193
8.3 Using Recursion 194
Traversing a Maze 194
The Towers of Hanoi 202
8.4 Analyzing Recursive Algorithms 207

9. Searching and Sorting
9.1 Searching 216
Static Methods 217
Generic Methods 217
Linear Search 218
Binary Search 220
Comparing Search Algorithms 222
9.2 Sorting 223
Selection Sort 226
Insertion Sort 228
Bubble Sort 230
Quick Sort 232
Merge Sort 236
9.3 Radix Sort 239

10. Trees
10.1 Trees 250
Tree Classifications 251
10.2 Strategies for Implementing Trees 253
Computational Strategy for Array
Implementation of Trees 253
Simulated Link Strategy for Array
Implementation of Trees 253
Analysis of Trees 255
10.3 Tree Traversals 256
Preorder Traversal 256
Inorder Traversal 257
Postorder Traversal 257
Level-Order Traversal 258
10.4 A Binary Tree ADT 259
10.5 Using Binary Trees: Expression Trees 263
10.6 A Back Pain Analyzer 275
10.7 Implementing Binary Trees with Links 279
The find Method 284
The iteratorInOrder Method 286

11. Binary Search Trees
11.1 A Binary Search Tree 294
11.2 Implementing Binary Search Trees: With Links 296
The addElement Operation 297
The removeElement Operation 300
The removeAllOccurrences Operation 303
The removeMin Operation 304
Implementing Binary Search Trees: With Arrays 306
11.3 Using Binary Search Trees: Implementing
Ordered Lists 306
Analysis of the BinarySearchTreeList
Implementation 309
11.4 Balanced Binary Search Trees 310
Right Rotation 311
Left Rotation 312
Rightleft Rotation 313
Leftright Rotation 313
11.5 Implementing BSTs: AVL Trees 314
Right Rotation in an AVL Tree 315
Left Rotation in an AVL Tree 315
Rightleft Rotation in an AVL Tree 315
Leftright Rotation in an AVL Tree 317
11.6 Implementing BSTs: Red/Black Trees 317
Insertion into a Red/Black Tree 318
Element Removal from a Red/Black Tree 321

12. Heaps and Priority Queues
12.1 A Heap 332
The addElement Operation 334
The removeMin Operation 335
The findMin Operation 336
12.2 Using Heaps: Priority Queues 336
12.3 Implementing Heaps: With Links 340
The addElement Operation 342
The removeMin Operation 344
The findMin Operation 347
12.4 Implementing Heaps: With Arrays 347
The addElement Operation 349
The removeMin Operation 350
The findMin Operation 352
12.5 Using Heaps: Heap Sort 352

13. Sets and Maps
13.1 Set and Map Collections 360
13.2 Sets and Maps in the Java API 360
13.3 Using Sets: Domain Blocker 363
13.4 Using Maps: Product Sales 366
13.5 Using Maps: User Management 370
13.6 Implementing Sets and Maps Using Trees 375
13.7 Implementing Sets and Maps Using Hashing 375

14. Multi-way Search Trees
14.1 Combining Tree Concepts 384
14.2 2-3 Trees 384
Inserting Elements into a 2-3 Tree 385
Removing Elements from a 2-3 Tree 387
14.3 2-4 Trees 390
14.4 B-Trees 392
B*-Trees 393
B+-Trees 393
Analysis of B-Trees 394
14.5 Implementation Strategies for B-Trees 394

15. Graphs
15.1 Undirected Graphs 402
15.2 Directed Graphs 403
15.3 Networks 405
15.4 Common Graph Algorithms 406
Traversals 406
Testing for Connectivity 410
Minimum Spanning Trees 412
Determining the Shortest Path 415
15.5 Strategies for Implementing Graphs 415
Adjacency Lists 416
Adjacency Matrices 416
15.6 Implementing Undirected Graphs with an Adjacency Matrix 417
The addEdge Method 422
The addVertex Method 422
The expandCapacity Method 423
Other Methods 424

Appendix A: UML
The Unified Modeling Language (UML) 430
UML Class Diagrams 430
UML Relationships 432

Appendix B: Object-Oriented Design
B.1 Overview of Object-Orientation 438
B.2 Using Objects 438
Abstraction 439
Creating Objects 440
B.3 C lass Libraries and Packages 442
The import Declaration 442
B.4 State and Behavior 443
B.5 Classes 444
Instance Data 447
B.6 Encapsulation 448
Visibility Modifiers 448
Local Data 450
B.7 Constructors 450
B.8 Method Overloading 451
B.9 R eferences Revisited 452
The Null Reference 452
The this Reference 453
Aliases 455
Garbage Collection 456
Passing Objects as Parameters 457
B.10 The static Modifier 457
Static Variables 458
Static Methods 458
B.11 Wrapper Classes 459
B.12 Interfaces 460
The Comparable Interface 461
B.13 Inheritance 462
Derived Classes 462
The protected Modifier 464
The super Reference 465
Overriding Methods 465
B.14 C lass Hierarchies 466
The Object Class 467
Abstract Classes 468
Interface Hierarchies 470
B.15 Polymorphism 470
References and Class Hierarchies 471
Polymorphism via Inheritance 472
Polymorphism via Interfaces 472
B.16 Exceptions 475
Exception Messages 476
The try Statement 476
Exception Propagation 477
The Exception Class Hierarchy 478

Appendix C: Java Graphics
C.1 Pixels and Coordinates 490
C.2 Representing Color 491
C.3 Drawing Shapes 492
C.4 Polygons and Polylines 501
The Polygon Class 504

Appendix D: Graphical User Interfaces
D.1 GUI Elements 512
Frames and Panels 513
Buttons and Action Events 517
Determining Event Sources 519
D.2 More Components 522
Text Fields 522
Check Boxes 525
Radio Buttons 529
Sliders 533
Combo Boxes 538
Timers 543
D.3 Layout Managers 548
Flow Layout 550
Border Layout 553
Grid Layout 557
Box Layout 560
Containment Hierarchies 563
D.4 Mouse and Key Events 563
Mouse Events 563
Key Events 572
Extending Adapter Classes 578
D.5 Dialog Boxes 579
File Choosers 582
Color Choosers 585
D.6 Some Important Details 586
Borders 586
Tool Tips and Mnemonics 590
D.7 GUI Design 597

Appendix E: Hashing
E.1 Hashing 608
E.2 Hashing Functions 610
The Division Method 610
The Folding Method 611
The Mid-Square Method 611
The Radix Transformation Method 612
The Digit Analysis Method 612
The Length-Dependent Method 612
Hashing Functions in the Java Language 613
E.3 Resolving Collisions 613
Chaining 613
Open Addressing 616
E.4 Deleting Elements from a Hash Table 620
Deleting from a Chained Implementation 620
Deleting from an Open Addressing
Implementation 621
E.5 Hash Tables in the Java Collections API 622
The Hashtable Class 622
The HashSet Class 624
The HashMap Class 624
The IdentityHashMap Class 625
The WeakHashMap Class 626
LinkedHashSet and LinkedHashMap 627

Appendix F: Regular Expressions

Your questions answered

Introducing Pearson+. Reimagined learning, designed for you. Choose from one eText or over 1,500 eTexts and study tools, all in one place, for one low monthly subscription. A new way to buy books that fits your budget. Make the most of your study time with offline access, enhanced search, notes and flashcards — to get organized, get the work done quicker and get results. Plus, with the app, put textbooks in your pocket and learn wherever. It's time to upgrade the textbook and simplify learning, so you can have time to live too.

Pearson eText is an easy-to-use digital textbook available from Pearson+. Make it your own by adding notes and highlights. Download the Pearson+ mobile app to learn on the go, even offline. Listen on the go with our new audiobook feature, available for most titles.

When you choose a plan, you're signing up for a 4-month term. We will charge your payment method each month until your 4-month term has ended. After that, we'll automatically renew your subscription and charge you on a month-to-month basis unless you turn off auto-renewal in My account.

When you purchase a Pearson+ subscription, it will last a minimum of 4 months, and then automatically renew each month thereafter unless you turn off auto-renew in My account.

If you want to stop your subscription at the end of your 4-month term, simply turn off auto-renew from My account. To avoid the next payment charge, make sure you turn auto renewal off 1 day before the auto renewal date.

You can subscribe again after auto-renew has been turned off by purchasing another Pearson+ subscription.

We use your credit card to renew your subscription automatically. To make sure your learning is uninterrupted, please check your card details before your first monthly payment.

With a Multi Pearson+ subscription plan, you can download up to 5 titles on the Pearson+ app from My list on each of your authorized devices every month.

When you're using your Multi Pearson+ subscription plan in a browser, you can select and read from as many titles as you like.