{"product_id":"data-structures-9781119703617","title":"Data Structures","description":"\u003cb\u003eBook Synopsis\u003c\/b\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cb\u003eTable of Contents\u003c\/b\u003e\u003cbr\u003e\u003cp\u003ePreface iii\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 1 Object-Oriented Programming and Class Hierarchies 1\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1.1 Abstract Data Types (ADTs), Interfaces, and the Java API 2\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eInterfaces 2\u003c\/p\u003e \u003cp\u003eThe implements Clause 5\u003c\/p\u003e \u003cp\u003eDeclaring a Variable of an Interface Type 6\u003c\/p\u003e \u003cp\u003eExercises for Section 1.1 6\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1.2 Introduction to OOP 7\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eA Superclass and Subclass Example 8\u003c\/p\u003e \u003cp\u003eUse of this. 9\u003c\/p\u003e \u003cp\u003eInitializing Data Fields in a Subclass 10\u003c\/p\u003e \u003cp\u003eThe No-Parameter Constructor 11\u003c\/p\u003e \u003cp\u003eProtected Visibility for Superclass Data Fields 11\u003c\/p\u003e \u003cp\u003e\u003ci\u003eIs-a \u003c\/i\u003eversus \u003ci\u003eHas-a \u003c\/i\u003eRelationships 12\u003c\/p\u003e \u003cp\u003eExercises for Section 1.2 12\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1.3 Method Overriding, Method Overloading, and Polymorphism 13\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eMethod Overriding 13\u003c\/p\u003e \u003cp\u003eMethod Overloading 15\u003c\/p\u003e \u003cp\u003ePolymorphism 17\u003c\/p\u003e \u003cp\u003eMethods with Class Parameters 17\u003c\/p\u003e \u003cp\u003eExercises for Section 1.3 18\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1.4 Abstract Classes 19\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eReferencing Actual Objects 21\u003c\/p\u003e \u003cp\u003eInitializing Data Fields in an Abstract Class 21\u003c\/p\u003e \u003cp\u003eAbstract Class Number and the Java Wrapper Classes 21\u003c\/p\u003e \u003cp\u003eSummary of Features of Actual Classes, Abstract Classes, and Interfaces 22\u003c\/p\u003e \u003cp\u003eImplementing Multiple Interfaces 23\u003c\/p\u003e \u003cp\u003eExtending an Interface 23\u003c\/p\u003e \u003cp\u003eExercises for Section 1.4 24\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1.5 Class \u003c\/b\u003e\u003cb\u003eObject and Casting 24\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Method toString 24\u003c\/p\u003e \u003cp\u003eOperations Determined by Type of Reference Variable 25\u003c\/p\u003e \u003cp\u003eCasting in a Class Hierarchy 26\u003c\/p\u003e \u003cp\u003eUsing instanceof to Guard a Casting Operation 27\u003c\/p\u003e \u003cp\u003eThe Class Class 29\u003c\/p\u003e \u003cp\u003eExercises for Section 1.5 29\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1.6 A Java Inheritance Example—The \u003c\/b\u003e\u003cb\u003eException Class Hierarchy 30\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eDivision by Zero 30\u003c\/p\u003e \u003cp\u003eArray Index Out of Bounds 30\u003c\/p\u003e \u003cp\u003eNull Pointer 31\u003c\/p\u003e \u003cp\u003eThe Exception Class Hierarchy 31\u003c\/p\u003e \u003cp\u003eThe Class Throwable 31\u003c\/p\u003e \u003cp\u003eChecked and Unchecked Exceptions 32\u003c\/p\u003e \u003cp\u003eHandling Exceptions to Recover from Errors 34\u003c\/p\u003e \u003cp\u003eUsing try−catch to Recover from an Error 35\u003c\/p\u003e \u003cp\u003eThrowing an Exception When Recovery Is Not Obvious 35\u003c\/p\u003e \u003cp\u003eExercises for Section 1.6 36\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1.7 Packages and Visibility 37\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003ePackages 37\u003c\/p\u003e \u003cp\u003eThe No−Package−Declared Environment 37\u003c\/p\u003e \u003cp\u003ePackage Visibility 38\u003c\/p\u003e \u003cp\u003eVisibility Supports Encapsulation 38\u003c\/p\u003e \u003cp\u003eExercises for Section 1.7 39\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1.8 A Shape Class Hierarchy 40\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study\u003c\/i\u003e: Processing Geometric Figures 40\u003c\/p\u003e \u003cp\u003eExercises for Section 1.8 46\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 46\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava Constructs Introduced in This Chapter 47\u003c\/p\u003e \u003cp\u003eJava API Classes Introduced in This Chapter 47\u003c\/p\u003e \u003cp\u003eUser-Defined Interfaces and Classes in This Chapter 47\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 47\u003c\/p\u003e \u003cp\u003eReview Questions 48\u003c\/p\u003e \u003cp\u003eProgramming Projects 49\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 51\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 2 Lists and the Collections Framework 53\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.1 Algorithm Efficiency and Big-O 54\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eBig-O Notation 56\u003c\/p\u003e \u003cp\u003eFormal Definition of Big-O 57\u003c\/p\u003e \u003cp\u003eSummary of Notation 60\u003c\/p\u003e \u003cp\u003eComparing Performance 60\u003c\/p\u003e \u003cp\u003eThe Power of O(log \u003ci\u003en\u003c\/i\u003e) Algorithms 62\u003c\/p\u003e \u003cp\u003eAlgorithms with Exponential and Factorial Growth Rates 62\u003c\/p\u003e \u003cp\u003eExercises for Section 2.1 63\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.2 The \u003c\/b\u003e\u003cb\u003eList Interface and ArrayList Class 63\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe ArrayList Class 65\u003c\/p\u003e \u003cp\u003eGeneric Collections 67\u003c\/p\u003e \u003cp\u003eExercises for Section 2.2 69\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.3 Applications of \u003c\/b\u003e\u003cb\u003eArrayList 70\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eA Phone Directory Application 71\u003c\/p\u003e \u003cp\u003eExercises for Section 2.3 72\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.4 Implementation of an \u003c\/b\u003e\u003cb\u003eArrayList Class 72\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Constructor for Class KWArrayList 73\u003c\/p\u003e \u003cp\u003eThe add(E anEntry) Method 74\u003c\/p\u003e \u003cp\u003eThe add(int index, E anEntry) Method 75\u003c\/p\u003e \u003cp\u003eThe set and get Methods 76\u003c\/p\u003e \u003cp\u003eThe remove Method 76\u003c\/p\u003e \u003cp\u003eThe reallocate Method 77\u003c\/p\u003e \u003cp\u003ePerformance of the KWArrayList Algorithms 77\u003c\/p\u003e \u003cp\u003eExercises for Section 2.4 77\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.5 Single-Linked Lists 78\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eA List Node 80\u003c\/p\u003e \u003cp\u003eConnecting Nodes 81\u003c\/p\u003e \u003cp\u003eA Single-Linked List Class 81\u003c\/p\u003e \u003cp\u003eInserting a Node in a List 82\u003c\/p\u003e \u003cp\u003eRemoving a Node 83\u003c\/p\u003e \u003cp\u003eCompleting the KWSingleLinkedList Class 84\u003c\/p\u003e \u003cp\u003eThe get and set Methods 85\u003c\/p\u003e \u003cp\u003eThe add Methods 85\u003c\/p\u003e \u003cp\u003eExercises for Section 2.5 86\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.6 Double-Linked Lists and Circular Lists 87\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Node Class 88\u003c\/p\u003e \u003cp\u003eInserting into a Double-Linked List 88\u003c\/p\u003e \u003cp\u003eRemoving from a Double-Linked List 89\u003c\/p\u003e \u003cp\u003eA Double-Linked List Class 90\u003c\/p\u003e \u003cp\u003eCircular Lists 90\u003c\/p\u003e \u003cp\u003eExercises for Section 2.6 91\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.7 The \u003c\/b\u003e\u003cb\u003eLinkedList Class and the Iterator, ListIterator, and Iterable Interfaces 91\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe LinkedList Class 91\u003c\/p\u003e \u003cp\u003eThe Iterator 92\u003c\/p\u003e \u003cp\u003eThe Iterator Interface 93\u003c\/p\u003e \u003cp\u003eThe Enhanced for Loop 95\u003c\/p\u003e \u003cp\u003eThe ListIterator Interface 95\u003c\/p\u003e \u003cp\u003eComparison of Iterator and ListIterator 97\u003c\/p\u003e \u003cp\u003eConversion between a ListIterator and an Index 97\u003c\/p\u003e \u003cp\u003eThe Iterable Interface 97\u003c\/p\u003e \u003cp\u003eExercises for Section 2.7 98\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.8 Application of the \u003c\/b\u003e\u003cb\u003eLinkedList Class 98\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study\u003c\/i\u003e: Maintaining an Ordered List 99\u003c\/p\u003e \u003cp\u003eExercises for Section 2.8 105\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.9 Implementation of a Double-Linked List Class 105\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eImplementing the KWLinkedList Methods 106\u003c\/p\u003e \u003cp\u003eA Class That Implements the ListIterator Interface 107\u003c\/p\u003e \u003cp\u003eThe Constructor 108\u003c\/p\u003e \u003cp\u003eThe hasNext and next Methods 108\u003c\/p\u003e \u003cp\u003eThe hasPrevious and previous Methods 109\u003c\/p\u003e \u003cp\u003eThe add Method 110\u003c\/p\u003e \u003cp\u003eInner Classes: Static and Nonstatic 112\u003c\/p\u003e \u003cp\u003eExercises for Section 2.9 113\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2.10 The Collections Framework Design 114\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Collection Interface 114\u003c\/p\u003e \u003cp\u003eCommon Features of Collections 114\u003c\/p\u003e \u003cp\u003eThe AbstractCollection, AbstractList, and AbstractSequentialList Classes 116\u003c\/p\u003e \u003cp\u003eThe List and RandomAccess Interfaces (Advanced) 116\u003c\/p\u003e \u003cp\u003eExercises for Section 2.10 117\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 117\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava API Interfaces and Classes Introduced in This Chapter 118\u003c\/p\u003e \u003cp\u003eUser-Defined Interfaces and Classes in this Chapter 119\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 119\u003c\/p\u003e \u003cp\u003eReview Questions 119\u003c\/p\u003e \u003cp\u003eProgramming Projects 120\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 122\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 3 Testing and Debugging 123\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e3.1 Types of Testing 124\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003ePreparations for Testing 126\u003c\/p\u003e \u003cp\u003eTesting Tips for Program Systems 126\u003c\/p\u003e \u003cp\u003eExercises for Section 3.1 127\u003c\/p\u003e \u003cp\u003e\u003cb\u003e3.2 Specifying the Tests 127\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eTesting Boundary Conditions 127\u003c\/p\u003e \u003cp\u003eExercises for Section 3.2 128\u003c\/p\u003e \u003cp\u003e\u003cb\u003e3.3 Stubs and Drivers 129\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eStubs 129\u003c\/p\u003e \u003cp\u003ePreconditions and Postconditions 129\u003c\/p\u003e \u003cp\u003eDrivers 130\u003c\/p\u003e \u003cp\u003eExercises for Section 3.3 130\u003c\/p\u003e \u003cp\u003e\u003cb\u003e3.4 The JUnit5 Platform 130\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eExercises for Section 3.4 135\u003c\/p\u003e \u003cp\u003e\u003cb\u003e3.5 Test-Driven Development 136\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eExercises for Section 3.5 140\u003c\/p\u003e \u003cp\u003e\u003cb\u003e3.6 Testing Interactive Programs in JUnit 140\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eByteArrayInputStream 141\u003c\/p\u003e \u003cp\u003eByteArrayOutputStream 141\u003c\/p\u003e \u003cp\u003eExercises for Section 3.6 142\u003c\/p\u003e \u003cp\u003e\u003cb\u003e3.7 Debugging a Program 143\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eUsing a Debugger 144\u003c\/p\u003e \u003cp\u003eThe IntelliJ and Eclipse Debuggers 144\u003c\/p\u003e \u003cp\u003eExercises for Section 3.7 147\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 148\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava API Classes Introduced in This Chapter 149\u003c\/p\u003e \u003cp\u003eUser-Defined Interfaces and Classes in This Chapter 149\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 149\u003c\/p\u003e \u003cp\u003eReview Questions 149\u003c\/p\u003e \u003cp\u003eProgramming Projects 149\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 151\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 4 Stacks, Queues, and Deques 152\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4.1 Stack Abstract Data Type 153\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eSpecification of the Stack Abstract Data Type 153\u003c\/p\u003e \u003cp\u003eExercises for Section 4.1 155\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4.2 Stack Applications 156\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eFinding Palindromes 156\u003c\/p\u003e \u003cp\u003eExercises for Section 4.2 160\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4.3 Implementing a Stack 160\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eImplementing a Stack with an ArrayList Component 160\u003c\/p\u003e \u003cp\u003eImplementing a Stack as a Linked Data Structure 162\u003c\/p\u003e \u003cp\u003eComparison of Stack Implementations 163\u003c\/p\u003e \u003cp\u003eExercises for Section 4.3 164\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4.4 Additional Stack Applications 164\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study\u003c\/i\u003e: Evaluating Postfix Expressions 165\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study\u003c\/i\u003e: Converting from Infix to Postfix 170\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study\u003c\/i\u003e: Converting Expressions with Parentheses 178\u003c\/p\u003e \u003cp\u003eTying the Case Studies Together 181\u003c\/p\u003e \u003cp\u003eExercises for Section 4.4 181\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4.5 Queue Abstract Data Type 182\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eA Print Queue 182\u003c\/p\u003e \u003cp\u003eThe Unsuitability of a “Print Stack” 183\u003c\/p\u003e \u003cp\u003eA Queue of Customers 183\u003c\/p\u003e \u003cp\u003eUsing a Queue for Traversing a Multi-Branch Data Structure 183\u003c\/p\u003e \u003cp\u003eSpecification for a Queue Interface 184\u003c\/p\u003e \u003cp\u003eClass LinkedList Implements the Queue Interface 184\u003c\/p\u003e \u003cp\u003eExercises for Section 4.5 185\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4.6 Queue Applications 186\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eMaintaining a Queue 186\u003c\/p\u003e \u003cp\u003eExercises for Section 4.6 191\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4.7 Implementing the \u003c\/b\u003e\u003cb\u003eQueue Interface 192\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eUsing a Double-Linked List to Implement the Queue Interface 192\u003c\/p\u003e \u003cp\u003eUsing a Single-Linked List to Implement the Queue Interface 192\u003c\/p\u003e \u003cp\u003eUsing a Circular Array to Implement the Queue Interface 194\u003c\/p\u003e \u003cp\u003eOverview of the Design 194\u003c\/p\u003e \u003cp\u003eImplementing ArrayQueue 196\u003c\/p\u003e \u003cp\u003eIncreasing Queue Capacity 198\u003c\/p\u003e \u003cp\u003eImplementing Class ArrayQueue.Iter 199\u003c\/p\u003e \u003cp\u003eComparing the Three Implementations 200\u003c\/p\u003e \u003cp\u003eExercises for Section 4.7 201\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4.8 The \u003c\/b\u003e\u003cb\u003eDeque Interface 201\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eClasses that Implement Deque 202\u003c\/p\u003e \u003cp\u003eUsing a Deque as a Queue 203\u003c\/p\u003e \u003cp\u003eUsing a Deque as a Stack 203\u003c\/p\u003e \u003cp\u003eExercises for Section 4.8 204\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 205\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava API Classes Introduced in This Chapter 205\u003c\/p\u003e \u003cp\u003eUser-Defined Interfaces and Classes in This Chapter 205\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 206\u003c\/p\u003e \u003cp\u003eReview Questions 207\u003c\/p\u003e \u003cp\u003eProgramming Projects 208\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 211\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 5 Recursion 213\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e5.1 Recursive Thinking 214\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eSteps to Design a Recursive Algorithm 216\u003c\/p\u003e \u003cp\u003eProving that a Recursive Method Is Correct 218\u003c\/p\u003e \u003cp\u003eTracing a Recursive Method 218\u003c\/p\u003e \u003cp\u003eThe Run-Time Stack and Activation Frames 219\u003c\/p\u003e \u003cp\u003eExercises for Section 5.1 220\u003c\/p\u003e \u003cp\u003e\u003cb\u003e5.2 Recursive Definitions of Mathematical Formulas 221\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eTail Recursion versus Iteration 225\u003c\/p\u003e \u003cp\u003eEfficiency of Recursion 225\u003c\/p\u003e \u003cp\u003eExercises for Section 5.2 228\u003c\/p\u003e \u003cp\u003e\u003cb\u003e5.3 Recursive Array Search 229\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eDesign of a Recursive Linear Search Algorithm 229\u003c\/p\u003e \u003cp\u003eImplementation of Linear Search 230\u003c\/p\u003e \u003cp\u003eDesign of a Binary Search Algorithm 231\u003c\/p\u003e \u003cp\u003eEfficiency of Binary Search 232\u003c\/p\u003e \u003cp\u003eThe Comparable Interface 233\u003c\/p\u003e \u003cp\u003eImplementation of Binary Search 233\u003c\/p\u003e \u003cp\u003eTesting Binary Search 235\u003c\/p\u003e \u003cp\u003eMethod Arrays.binarySearch 236\u003c\/p\u003e \u003cp\u003eExercises for Section 5.3 236\u003c\/p\u003e \u003cp\u003e\u003cb\u003e5.4 Recursive Data Structures 236\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eRecursive Definition of a Linked List 237\u003c\/p\u003e \u003cp\u003eClass LinkedListRec 237\u003c\/p\u003e \u003cp\u003eMethod size 237\u003c\/p\u003e \u003cp\u003eMethod toString 238\u003c\/p\u003e \u003cp\u003eMethod replace 238\u003c\/p\u003e \u003cp\u003eMethod add 239\u003c\/p\u003e \u003cp\u003eRemoving a List Node 239\u003c\/p\u003e \u003cp\u003eExercises for Section 5.4 240\u003c\/p\u003e \u003cp\u003e\u003cb\u003e5.5 Problem Solving with Recursion 241\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eTowers of Hanoi 241\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eCounting Cells in a Blob 246\u003c\/p\u003e \u003cp\u003eExercises for Section 5.5 250\u003c\/p\u003e \u003cp\u003e\u003cb\u003e5.6 Backtracking 250\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eFinding a Path through a Maze 251\u003c\/p\u003e \u003cp\u003eExercises for Section 5.6 255\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 255\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eUser-Defined Classes in This Chapter 256\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 256\u003c\/p\u003e \u003cp\u003eReview Questions 256\u003c\/p\u003e \u003cp\u003eProgramming Projects 257\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 258\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 6 Trees 259\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e6.1 Tree Terminology and Applications 260\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eTree Terminology 260\u003c\/p\u003e \u003cp\u003eBinary Trees 261\u003c\/p\u003e \u003cp\u003eSome Types of Binary Trees 262\u003c\/p\u003e \u003cp\u003eGeneral Trees 265\u003c\/p\u003e \u003cp\u003eExercises for Section 6.1 266\u003c\/p\u003e \u003cp\u003e\u003cb\u003e6.2 Tree Traversals 267\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eVisualizing Tree Traversals 268\u003c\/p\u003e \u003cp\u003eTraversals of Binary Search Trees and Expression Trees 268\u003c\/p\u003e \u003cp\u003eExercises for Section 6.2 269\u003c\/p\u003e \u003cp\u003e\u003cb\u003e6.3 Implementing a \u003c\/b\u003e\u003cb\u003eBinaryTree Class 270\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Node Class 270\u003c\/p\u003e \u003cp\u003eThe BinaryTree Class 271\u003c\/p\u003e \u003cp\u003eThe Constructors 272\u003c\/p\u003e \u003cp\u003eThe getLeftSubtree and getRightSubtree Methods 273\u003c\/p\u003e \u003cp\u003eThe isLeaf Method 274\u003c\/p\u003e \u003cp\u003eThe toString Method 274\u003c\/p\u003e \u003cp\u003eThe Recursive toString Method 274\u003c\/p\u003e \u003cp\u003eExercises for Section 6.3 276\u003c\/p\u003e \u003cp\u003e\u003cb\u003e6.4 Lambda Expressions and Functional Interfaces 277\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eFunctional Interfaces 278\u003c\/p\u003e \u003cp\u003eA General Preorder Traversal Method 281\u003c\/p\u003e \u003cp\u003eUsing preOrderTraverse 282\u003c\/p\u003e \u003cp\u003eExercises for Section 6.4 282\u003c\/p\u003e \u003cp\u003e\u003cb\u003e6.5 Binary Search Trees 283\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eOverview of a Binary Search Tree 283\u003c\/p\u003e \u003cp\u003ePerformance 284\u003c\/p\u003e \u003cp\u003eInterface SearchTree 284\u003c\/p\u003e \u003cp\u003eThe BinarySearchTree Class 285\u003c\/p\u003e \u003cp\u003eImplementing the find Methods 286\u003c\/p\u003e \u003cp\u003eInsertion into a Binary Search Tree 287\u003c\/p\u003e \u003cp\u003eImplementing the add Methods 287\u003c\/p\u003e \u003cp\u003eRemoval from a Binary Search Tree 289\u003c\/p\u003e \u003cp\u003eImplementing the delete Methods 291\u003c\/p\u003e \u003cp\u003eMethod findLargestChild 293\u003c\/p\u003e \u003cp\u003eTesting a Binary Search Tree 294\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eWriting an Index for a Term Paper 294\u003c\/p\u003e \u003cp\u003eExercises for Section 6.5 297\u003c\/p\u003e \u003cp\u003e\u003cb\u003e6.6 Heaps and Priority Queues 298\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eInserting an Item into a Heap 298\u003c\/p\u003e \u003cp\u003eRemoving an Item from a Heap 299\u003c\/p\u003e \u003cp\u003eImplementing a Heap 299\u003c\/p\u003e \u003cp\u003ePerformance of the Heap 302\u003c\/p\u003e \u003cp\u003ePriority Queues 302\u003c\/p\u003e \u003cp\u003eThe PriorityQueue Class 303\u003c\/p\u003e \u003cp\u003eThe offer Method 305\u003c\/p\u003e \u003cp\u003eThe poll Method 306\u003c\/p\u003e \u003cp\u003eThe Other Methods 307\u003c\/p\u003e \u003cp\u003eExercises for Section 6.6 307\u003c\/p\u003e \u003cp\u003e\u003cb\u003e6.7 Huffman Trees 308\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eBuilding a Custom Huffman Tree 309\u003c\/p\u003e \u003cp\u003eExercises for Section 6.7 315\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 316\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava API Interfaces and Classes Introduced in This Chapter 317\u003c\/p\u003e \u003cp\u003eUser-Defined Interfaces and Classes in This Chapter 317\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 317\u003c\/p\u003e \u003cp\u003eReview Questions 318\u003c\/p\u003e \u003cp\u003eProgramming Projects 318\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 321\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 7 Sets and Maps 322\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7.1 Sets and the Set Interface 323\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Set Abstraction 323\u003c\/p\u003e \u003cp\u003eThe Set Interface and Methods 325\u003c\/p\u003e \u003cp\u003eUsing Method of to Initialize a Collection 327\u003c\/p\u003e \u003cp\u003eComparison of Lists and Sets 327\u003c\/p\u003e \u003cp\u003eExercises for Section 7.1 328\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7.2 Maps and the \u003c\/b\u003eMap \u003cb\u003eInterface 329\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Map Hierarchy 330\u003c\/p\u003e \u003cp\u003eThe Map Interface 330\u003c\/p\u003e \u003cp\u003eCreating a Map 331\u003c\/p\u003e \u003cp\u003eExercises for Section 7.2 333\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7.3 Hash Tables 333\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eHash Codes and Index Calculation 334\u003c\/p\u003e \u003cp\u003eMethods for Generating Hash Codes 335\u003c\/p\u003e \u003cp\u003eOpen Addressing 335\u003c\/p\u003e \u003cp\u003eTable Wraparound and Search Termination 336\u003c\/p\u003e \u003cp\u003eTraversing a Hash Table 338\u003c\/p\u003e \u003cp\u003eDeleting an Item Using Open Addressing 338\u003c\/p\u003e \u003cp\u003eReducing Collisions by Expanding the Table Size 338\u003c\/p\u003e \u003cp\u003eAlgorithm for rehashing 339\u003c\/p\u003e \u003cp\u003eReducing Collisions Using Quadratic Probing 339\u003c\/p\u003e \u003cp\u003eProblems with Quadratic Probing 340\u003c\/p\u003e \u003cp\u003eChaining 340\u003c\/p\u003e \u003cp\u003ePerformance of Hash Tables 341\u003c\/p\u003e \u003cp\u003ePerformance of Open Addressing versus Chaining 341\u003c\/p\u003e \u003cp\u003ePerformance of Hash Tables versus Sorted Arrays and Binary Search Trees 342\u003c\/p\u003e \u003cp\u003eStorage Requirements for Hash Tables, Sorted Arrays, and Trees 342\u003c\/p\u003e \u003cp\u003eStorage requirements for Open Addressing and Chaining 343\u003c\/p\u003e \u003cp\u003eExercises for Section 7.3 343\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7.4 Implementing the Hash Table 345\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eInterface KWHashMap 345\u003c\/p\u003e \u003cp\u003eClass Entry 345\u003c\/p\u003e \u003cp\u003eClass HashtableOpen 346\u003c\/p\u003e \u003cp\u003eClass HashtableChain 351\u003c\/p\u003e \u003cp\u003eTesting the Hash Table Implementations 354\u003c\/p\u003e \u003cp\u003eExercises for Section 7.4 355\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7.5 Implementation Considerations for \u003c\/b\u003e\u003cb\u003eMaps and Sets 355\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eMethods hashCode and equals 355\u003c\/p\u003e \u003cp\u003eImplementing HashSetOpen 356\u003c\/p\u003e \u003cp\u003eWriting HashSetOpen as an Adapter Class 356\u003c\/p\u003e \u003cp\u003eImplementing the Java Map and Set Interfaces 357\u003c\/p\u003e \u003cp\u003eInterface Map.Entry and Class AbstractMap.SimpleEntry 357\u003c\/p\u003e \u003cp\u003eCreating a Set View of a Map 358\u003c\/p\u003e \u003cp\u003eMethod entrySet and Classes EntrySet and SetIterator 358\u003c\/p\u003e \u003cp\u003eClasses TreeMap and TreeSet 359\u003c\/p\u003e \u003cp\u003eExercises for Section 7.5 360\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7.6 Additional Applications of \u003c\/b\u003e\u003cb\u003eMaps 360\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eImplementing a Cell Phone Contact list 360\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eCompleting the Huffman Coding Problem 362\u003c\/p\u003e \u003cp\u003eEncoding the Huffman Tree 366\u003c\/p\u003e \u003cp\u003eExercises for Section 7.6 367\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7.7 Navigable Sets and Maps 367\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eApplication of a NavigableMap 369\u003c\/p\u003e \u003cp\u003eExercises for Section 7.7 371\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7.8 Skip-Lists 371\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eSkip-List Structure 372\u003c\/p\u003e \u003cp\u003eSearching a Skip-List 372\u003c\/p\u003e \u003cp\u003ePerformance of a Skip-List Search 373\u003c\/p\u003e \u003cp\u003eInserting into a Skip-List 373\u003c\/p\u003e \u003cp\u003eIncreasing the Height of a Skip-List 374\u003c\/p\u003e \u003cp\u003eImplementing a Skip-List 374\u003c\/p\u003e \u003cp\u003eSkipList Methods for Search and Retrieval 375\u003c\/p\u003e \u003cp\u003eMethod put for Inserting into a Skip-List 376\u003c\/p\u003e \u003cp\u003eConstants and Methods for Computing Random Level 378\u003c\/p\u003e \u003cp\u003ePerformance of a Skip-List 378\u003c\/p\u003e \u003cp\u003eTesting Class Skip-List 379\u003c\/p\u003e \u003cp\u003eExercises for Section 7.8 379\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 380\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava API Interfaces and Classes Introduced in This Chapter 381\u003c\/p\u003e \u003cp\u003eUser-Defined Interfaces and Classes in This Chapter 381\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 381\u003c\/p\u003e \u003cp\u003eReview Questions 382\u003c\/p\u003e \u003cp\u003eProgramming Projects 383\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 384\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 8 Sorting 385\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.1 Using Java Sorting Methods 386\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eCollections.sort Methods 389\u003c\/p\u003e \u003cp\u003eMethod List.sort 389\u003c\/p\u003e \u003cp\u003eExercises for Section 8.1 390\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.2 Selection Sort 390\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eAnalysis of Selection Sort 391\u003c\/p\u003e \u003cp\u003eImplementation of Selection Sort 392\u003c\/p\u003e \u003cp\u003eExercises for Section 8.2 393\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.3 Insertion Sort 393\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eAnalysis of Insertion Sort 395\u003c\/p\u003e \u003cp\u003eImplementation of Insertion Sort 395\u003c\/p\u003e \u003cp\u003eExercises for Section 8.3 396\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.4 Comparison of Quadratic Sorts 397\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eComparisons versus Exchanges 398\u003c\/p\u003e \u003cp\u003eExercises for Section 8.4 398\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.5 Shell Sort: A Better Insertion Sort 398\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eAnalysis of Shell Sort 400\u003c\/p\u003e \u003cp\u003eImplementation of Shell Sort 400\u003c\/p\u003e \u003cp\u003eExercises for Section 8.5 401\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.6 Merge Sort 402\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eAnalysis of Merge 403\u003c\/p\u003e \u003cp\u003eImplementation of Merge 403\u003c\/p\u003e \u003cp\u003eDesign of Merge Sort 404\u003c\/p\u003e \u003cp\u003eTrace of Merge Sort Algorithm 404\u003c\/p\u003e \u003cp\u003eAnalysis of Merge Sort 405\u003c\/p\u003e \u003cp\u003eImplementation of Merge Sort 406\u003c\/p\u003e \u003cp\u003eExercises for Section 8.6 406\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.7 Timsort 407\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eMerging Adjacent Runs 410\u003c\/p\u003e \u003cp\u003ePerformance of Timsort 410\u003c\/p\u003e \u003cp\u003eImplementation of Timsort 411\u003c\/p\u003e \u003cp\u003eExercises for Section 8.7 414\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.8 Heapsort 414\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eFirst Version of a Heapsort Algorithm 414\u003c\/p\u003e \u003cp\u003eAnalysis of Revised Heapsort Algorithm 416\u003c\/p\u003e \u003cp\u003eImplementation of Heapsort 417\u003c\/p\u003e \u003cp\u003eExercises for Section 8.8 418\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.9 Quicksort 418\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eAlgorithm for Quicksort 419\u003c\/p\u003e \u003cp\u003eAnalysis of Quicksort 420\u003c\/p\u003e \u003cp\u003eImplementation of Quicksort 420\u003c\/p\u003e \u003cp\u003eAlgorithm for Partitioning 421\u003c\/p\u003e \u003cp\u003eImplementation of partition 422\u003c\/p\u003e \u003cp\u003eA Revised partition Algorithm 424\u003c\/p\u003e \u003cp\u003eImplementation of Revised partition Method 425\u003c\/p\u003e \u003cp\u003eExercises for Section 8.9 426\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.10 Testing the Sort Algorithms 427\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eExercises for Section 8.10 428\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8.11 The Dutch National Flag Problem (Optional Topic) 428\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eThe Problem of the Dutch National Flag 429\u003c\/p\u003e \u003cp\u003eExercises for Section 8.11 431\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 432\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava Classes Introduced in This Chapter 432\u003c\/p\u003e \u003cp\u003eUser-Defined Classes in This Chapter 432\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 433\u003c\/p\u003e \u003cp\u003eReview Questions 433\u003c\/p\u003e \u003cp\u003eProgramming Projects 433\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 434\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 9 Self-Balancing Search Trees 435\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e9.1 Tree Balance and Rotation 436\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eWhy Balance Is Important 436\u003c\/p\u003e \u003cp\u003eRotation 436\u003c\/p\u003e \u003cp\u003eAlgorithm for Rotation 437\u003c\/p\u003e \u003cp\u003eImplementing Rotation 438\u003c\/p\u003e \u003cp\u003eExercises for Section 9.1 440\u003c\/p\u003e \u003cp\u003e\u003cb\u003e9.2 AVL Trees 440\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eBalancing a Left–Left Tree 440\u003c\/p\u003e \u003cp\u003eBalancing a Left–Right Tree 441\u003c\/p\u003e \u003cp\u003eFour Kinds of Critically Unbalanced Trees 442\u003c\/p\u003e \u003cp\u003eImplementing an AVL Tree 444\u003c\/p\u003e \u003cp\u003eThe AVLNode Class 445\u003c\/p\u003e \u003cp\u003eInserting into an AVL Tree 446\u003c\/p\u003e \u003cp\u003eadd Starter Method 447\u003c\/p\u003e \u003cp\u003eRecursive add Method 447\u003c\/p\u003e \u003cp\u003eInitial Algorithm for rebalanceLeft 448\u003c\/p\u003e \u003cp\u003eThe Effect of Rotations on Balance 448\u003c\/p\u003e \u003cp\u003eRevised Algorithm for rebalanceLeft 449\u003c\/p\u003e \u003cp\u003eMethod rebalanceLeft 449\u003c\/p\u003e \u003cp\u003eThe decrementBalance Method 450\u003c\/p\u003e \u003cp\u003eRemoval from an AVL Tree 451\u003c\/p\u003e \u003cp\u003ePerformance of the AVL Tree 452\u003c\/p\u003e \u003cp\u003eExercises for Section 9.2 452\u003c\/p\u003e \u003cp\u003e\u003cb\u003e9.3 Red–Black Trees 453\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eInsertion into a Red–Black Tree 453\u003c\/p\u003e \u003cp\u003eImplementation of Red–Black Tree Class 458\u003c\/p\u003e \u003cp\u003eAlgorithm for Red–Black Tree Insertion 458\u003c\/p\u003e \u003cp\u003eThe add Starter Method 460\u003c\/p\u003e \u003cp\u003eThe Recursive add Method 461\u003c\/p\u003e \u003cp\u003eRemoval from a Red–Black Tree 462\u003c\/p\u003e \u003cp\u003ePerformance of a Red–Black Tree 462\u003c\/p\u003e \u003cp\u003eThe TreeMap and TreeSet Classes 463\u003c\/p\u003e \u003cp\u003eExercises for Section 9.3 463\u003c\/p\u003e \u003cp\u003e\u003cb\u003e9.4 2–3 Trees 464\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eSearching a 2–3 Tree 465\u003c\/p\u003e \u003cp\u003eInserting an Item into a 2–3 Tree 465\u003c\/p\u003e \u003cp\u003eInserting into a 2-Node Leaf 465\u003c\/p\u003e \u003cp\u003eInserting into a 3-Node Leaf with a 2-Node Parent 466\u003c\/p\u003e \u003cp\u003eInserting into a 3-Node Leaf with a 3-Node Parent 466\u003c\/p\u003e \u003cp\u003eAnalysis of 2–3 Trees and Comparison with Balanced Binary Trees 468\u003c\/p\u003e \u003cp\u003eRemoval from a 2–3 Tree 469\u003c\/p\u003e \u003cp\u003eExercises for Section 9.4 470\u003c\/p\u003e \u003cp\u003e\u003cb\u003e9.5 B-Trees and 2–3–4 Trees 470\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eB-Trees 471\u003c\/p\u003e \u003cp\u003eImplementing the B-Tree 472\u003c\/p\u003e \u003cp\u003eCode for the insert Method 474\u003c\/p\u003e \u003cp\u003eThe insertIntoNode Method 475\u003c\/p\u003e \u003cp\u003eThe splitNode Method 476\u003c\/p\u003e \u003cp\u003eRemoval from a B-Tree 478\u003c\/p\u003e \u003cp\u003eB+ Trees 479\u003c\/p\u003e \u003cp\u003e2–3–4 Trees 480\u003c\/p\u003e \u003cp\u003eRelating 2–3–4 Trees to Red–Black Trees 481\u003c\/p\u003e \u003cp\u003eExercises for Section 9.5 482\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 483\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava Classes Introduced in This Chapter 484\u003c\/p\u003e \u003cp\u003eUser-Defined Interfaces and Classes in This Chapter 484\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 485\u003c\/p\u003e \u003cp\u003eReview Questions 486\u003c\/p\u003e \u003cp\u003eProgramming Projects 486\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 489\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter 10 Graphs 492\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e10.1 Graph Terminology 493\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eVisual Representation of Graphs 493\u003c\/p\u003e \u003cp\u003eDirected and Undirected Graphs 494\u003c\/p\u003e \u003cp\u003ePaths and Cycles 494\u003c\/p\u003e \u003cp\u003eRelationship between Graphs and Trees 496\u003c\/p\u003e \u003cp\u003eGraph Applications 496\u003c\/p\u003e \u003cp\u003eExercises for Section 10.1 497\u003c\/p\u003e \u003cp\u003e\u003cb\u003e10.2 The Graph ADT and Edge Class 497\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eRepresenting Vertices and Edges 498\u003c\/p\u003e \u003cp\u003eExercises for Section 10.2 499\u003c\/p\u003e \u003cp\u003e\u003cb\u003e10.3 Implementing the Graph ADT 499\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eAdjacency List 499\u003c\/p\u003e \u003cp\u003eAdjacency Matrix 501\u003c\/p\u003e \u003cp\u003eOverview of the Hierarchy 501\u003c\/p\u003e \u003cp\u003eDeclaring the Graph Interface 502\u003c\/p\u003e \u003cp\u003eThe ListGraph Class 503\u003c\/p\u003e \u003cp\u003eComparing Implementations 506\u003c\/p\u003e \u003cp\u003eExercises for Section 10.3 507\u003c\/p\u003e \u003cp\u003e\u003cb\u003e10.4 Traversals of Graphs 508\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eBreadth-First Search 508\u003c\/p\u003e \u003cp\u003eDepth-First Search 513\u003c\/p\u003e \u003cp\u003eExercises for Section 10.4 519\u003c\/p\u003e \u003cp\u003e\u003cb\u003e10.5 Applications of Graph Traversals 519\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eShortest Path through a Maze 519\u003c\/p\u003e \u003cp\u003e\u003ci\u003eCase Study: \u003c\/i\u003eTopological Sort of a Graph 523\u003c\/p\u003e \u003cp\u003eExercises for Section 10.5 526\u003c\/p\u003e \u003cp\u003e\u003cb\u003e10.6 Algorithms Using Weighted Graphs 526\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eFinding the Shortest Path from a Vertex to All Other Vertices 526\u003c\/p\u003e \u003cp\u003eAnalysis of Dijkstra’s Algorithm 528\u003c\/p\u003e \u003cp\u003eMinimum Spanning Trees 530\u003c\/p\u003e \u003cp\u003eExercises for Section 10.6 533\u003c\/p\u003e \u003cp\u003e\u003cb\u003e10.7 A Heuristic Algorithm A* to Find the Best Path 534\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eA* (A-Star) an Improvement of Dijkstra’s Algorithm 535\u003c\/p\u003e \u003cp\u003eExercises for Section 10.7 541\u003c\/p\u003e \u003cp\u003e\u003cb\u003eChapter Review 541\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eUser-Defined Classes and Interfaces in This Chapter 542\u003c\/p\u003e \u003cp\u003eQuick-Check Exercises 542\u003c\/p\u003e \u003cp\u003eReview Questions 543\u003c\/p\u003e \u003cp\u003eProgramming Projects 543\u003c\/p\u003e \u003cp\u003eAnswers to Quick-Check Exercises 545\u003c\/p\u003e \u003cp\u003e\u003cb\u003eAppendix A Introduction to Java A-1\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.1 The Java Environment and Classes A-2\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Java Virtual Machine A-3\u003c\/p\u003e \u003cp\u003eThe Java Compiler A-3\u003c\/p\u003e \u003cp\u003eClasses and Objects A-3\u003c\/p\u003e \u003cp\u003eThe Java API A-3\u003c\/p\u003e \u003cp\u003eThe import Statement A-4\u003c\/p\u003e \u003cp\u003eMethod main A-4\u003c\/p\u003e \u003cp\u003eExecution of a Java Program A-5\u003c\/p\u003e \u003cp\u003eUse of jshell A-5\u003c\/p\u003e \u003cp\u003eExercises for Section A.1 A-6\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.2 Primitive Data Types and Reference Variables A-6\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003ePrimitive Data Types A-6\u003c\/p\u003e \u003cp\u003ePrimitive-Type Variables A-8\u003c\/p\u003e \u003cp\u003ePrimitive-Type Constants A-8\u003c\/p\u003e \u003cp\u003eOperators A-8\u003c\/p\u003e \u003cp\u003ePostfix and Prefix Increment A-10\u003c\/p\u003e \u003cp\u003eType Compatibility and Conversion A-10\u003c\/p\u003e \u003cp\u003eReferencing Objects A-11\u003c\/p\u003e \u003cp\u003eCreating Objects A-11\u003c\/p\u003e \u003cp\u003eExercises for Section A.2 A-12\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.3 Java Control Statements A-13\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eSequence and Compound Statements A-13\u003c\/p\u003e \u003cp\u003eSelection and Repetition Control A-13\u003c\/p\u003e \u003cp\u003eNested if Statements A-15\u003c\/p\u003e \u003cp\u003eThe switch Statement A-16\u003c\/p\u003e \u003cp\u003eExercises for Section A.3 A-17\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.4 Methods and Class \u003c\/b\u003e\u003cb\u003eMath A-17\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Instance Methods println and print A-18\u003c\/p\u003e \u003cp\u003eCall-by-Value Arguments A-18\u003c\/p\u003e \u003cp\u003eThe Class Math A-18\u003c\/p\u003e \u003cp\u003eEscape Sequences A-19\u003c\/p\u003e \u003cp\u003eExercises for Section A.4 A-20\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.5 The \u003c\/b\u003e\u003cb\u003eString, StringBuilder, StringBuffer, and StringJoiner Classes A-21\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe String Class A-21\u003c\/p\u003e \u003cp\u003eStrings Are Immutable A-23\u003c\/p\u003e \u003cp\u003eThe Garbage Collector A-24\u003c\/p\u003e \u003cp\u003eComparing Objects A-24\u003c\/p\u003e \u003cp\u003eThe String.format Method A-25\u003c\/p\u003e \u003cp\u003eThe Formatter Class A-26\u003c\/p\u003e \u003cp\u003eThe String.split Method A-27\u003c\/p\u003e \u003cp\u003eIntroduction to Regular Expressions A-27\u003c\/p\u003e \u003cp\u003eMatching One of a Group of Characters A-27\u003c\/p\u003e \u003cp\u003eQualifiers A-27\u003c\/p\u003e \u003cp\u003eDefined Character Groups A-28\u003c\/p\u003e \u003cp\u003eUnicode Character Class Support A-29\u003c\/p\u003e \u003cp\u003eThe StringBuilder and StringBuffer Classes A-29\u003c\/p\u003e \u003cp\u003eStringJoiner Class A-31\u003c\/p\u003e \u003cp\u003eExercises for Section A.5 A-32\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.6 Wrapper Classes for Primitive Types A-33\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eExercises for Section A.6 A-34\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.7 Defining Your Own Classes A-35\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003ePrivate Data Fields, Public Methods A-38\u003c\/p\u003e \u003cp\u003eConstructors A-39\u003c\/p\u003e \u003cp\u003eThe No-Parameter Constructor A-39\u003c\/p\u003e \u003cp\u003eModifier and Accessor Methods A-40\u003c\/p\u003e \u003cp\u003eUse of this. in a Method A-40\u003c\/p\u003e \u003cp\u003eThe Method toString A-40\u003c\/p\u003e \u003cp\u003eThe Method equals A-41\u003c\/p\u003e \u003cp\u003eDeclaring Local Variables in Class Person A-42\u003c\/p\u003e \u003cp\u003eAn Application that Uses Class Person A-42\u003c\/p\u003e \u003cp\u003eObjects as Arguments A-43\u003c\/p\u003e \u003cp\u003eClasses as Components of Other Classes A-44\u003c\/p\u003e \u003cp\u003eJava Documentation Style for Classes and Methods A-44\u003c\/p\u003e \u003cp\u003eExercises for Section A.7 A-47\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.8 Arrays A-47\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eData Field length A-49\u003c\/p\u003e \u003cp\u003eMethod Arrays.copyOf A-50\u003c\/p\u003e \u003cp\u003eMethod System.arrayCopy A-50\u003c\/p\u003e \u003cp\u003eArray Data Fields A-51\u003c\/p\u003e \u003cp\u003eArray Results and Arguments A-52\u003c\/p\u003e \u003cp\u003eArrays of Arrays A-52\u003c\/p\u003e \u003cp\u003eExercises for Section A.8 A-55\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.9 Enumeration Types A-56\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eUsing Enumeration Types A-57\u003c\/p\u003e \u003cp\u003eAssigning Values to Enumeration Types A-58\u003c\/p\u003e \u003cp\u003eExercises for Section A.9 A-58\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.10 I\/O Using Streams, Class \u003c\/b\u003e\u003cb\u003eScanner, and Class JOptionPane A-58\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe Scanner A-59\u003c\/p\u003e \u003cp\u003eUsing a Scanner to Read from a File A-61\u003c\/p\u003e \u003cp\u003eExceptions A-61\u003c\/p\u003e \u003cp\u003eTokenized Input A-61\u003c\/p\u003e \u003cp\u003eExtracting Tokens Using Scanner.findInLine A-62\u003c\/p\u003e \u003cp\u003eUsing a BufferedReader to Read from an Input Stream A-62\u003c\/p\u003e \u003cp\u003eOutput Streams A-62\u003c\/p\u003e \u003cp\u003ePassing Arguments to Method main A-63\u003c\/p\u003e \u003cp\u003eClosing Streams A-63\u003c\/p\u003e \u003cp\u003eTry with Resources A-63\u003c\/p\u003e \u003cp\u003eA Complete File-Processing Application A-64\u003c\/p\u003e \u003cp\u003eInput\/Output Using Class JOptionPane A-65\u003c\/p\u003e \u003cp\u003eConverting Numeric Strings to Numbers A-66\u003c\/p\u003e \u003cp\u003eGUI Menus Using Method showOptionDialog A-66\u003c\/p\u003e \u003cp\u003eExercises for Section A.10 A-67\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.11 Catching Exceptions A-67\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eCatching and Handling Exceptions A-68\u003c\/p\u003e \u003cp\u003eExercises for Section A.11 A-74\u003c\/p\u003e \u003cp\u003e\u003cb\u003eA.12 Throwing Exceptions A-74\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eThe throws Clause A-74\u003c\/p\u003e \u003cp\u003eThe throw Statement A-75\u003c\/p\u003e \u003cp\u003eExercises for Section A.12 A-78\u003c\/p\u003e \u003cp\u003e\u003cb\u003eAppendix Review A-79\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eJava Constructs Introduced in This Appendix A-81\u003c\/p\u003e \u003cp\u003eJava API Classes Introduced in This Appendix A-81\u003c\/p\u003e \u003cp\u003eUser‐Defined Interfaces and Classes in This Appendix A-82\u003c\/p\u003e \u003cp\u003eQuick‐Check Exercises A-82\u003c\/p\u003e \u003cp\u003eReview Questions A-82\u003c\/p\u003e \u003cp\u003eProgramming Projects A-83\u003c\/p\u003e \u003cp\u003eAnswer to Quick‐Check Exercises A-84\u003c\/p\u003e \u003cp\u003e\u003cb\u003eAppendix B Overview of UML A-85\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003eB.1 The Class Diagram A-85\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eRepresenting Classes and Interfaces A-86\u003c\/p\u003e \u003cp\u003eGeneralization A-87\u003c\/p\u003e \u003cp\u003eInner or Nested Classes A-88\u003c\/p\u003e \u003cp\u003eAggregation and Composition A-88\u003c\/p\u003e \u003cp\u003e\u003cb\u003eB.2 Object Diagrams A-89\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eGlossary G-1\u003c\/p\u003e \u003cp\u003eIndex I-1\u003c\/p\u003e","brand":"John Wiley \u0026 Sons Inc","offers":[{"title":"Default Title","offer_id":49407125553495,"sku":"9781119703617","price":113.95,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0817\/1739\/5799\/files\/9781119703617.jpg?v=1730498269","url":"https:\/\/bookcurl.com\/products\/data-structures-9781119703617","provider":"Book Curl","version":"1.0","type":"link"}