| |
| |
Preface | |
| |
| |
| |
Analyzing Algorithms and Problems: Principles and Examples | |
| |
| |
| |
Introduction | |
| |
| |
| |
Java as an Algorithm Language | |
| |
| |
| |
Mathematical Background | |
| |
| |
| |
Analyzing Algorithms and Problems | |
| |
| |
| |
Classifying Functions by Their Asymptotic Growth Rates | |
| |
| |
| |
Searching an Ordered Array | |
| |
| |
Exercises | |
| |
| |
Notes and References | |
| |
| |
| |
Data Abstraction and Basic Data Structures | |
| |
| |
| |
Introduction | |
| |
| |
| |
ADT Specification and Design Techniques | |
| |
| |
| |
Elementary ADTs--Lists and Trees | |
| |
| |
| |
Stacks and Queues | |
| |
| |
| |
ADTs for Dynamic Sets | |
| |
| |
Exercises | |
| |
| |
Notes and References | |
| |
| |
| |
Recursion and Induction | |
| |
| |
| |
Introduction | |
| |
| |
| |
Recursive Procedures | |
| |
| |
| |
What Is a Proof? | |
| |
| |
| |
Induction Proofs | |
| |
| |
| |
Proving Correctness of Procedures | |
| |
| |
| |
Recurrence Equations | |
| |
| |
| |
Recursion Trees | |
| |
| |
Exercises | |
| |
| |
Notes and References | |
| |
| |
| |
Sorting | |
| |
| |
| |
Introduction | |
| |
| |
| |
Insertion Sort | |
| |
| |
| |
Divide and Conquer | |
| |
| |
| |
Quicksort | |
| |
| |
| |
Merging Sorted Sequences | |
| |
| |
| |
Mergesort | |
| |
| |
| |
Lower Bounds for Sorting by Comparison of Keys | |
| |
| |
| |
Heapsort | |
| |
| |
| |
Comparison of Four Sorting Algorithms | |
| |
| |
| |
Shellsort | |
| |
| |
| |
Radix Sorting | |
| |
| |
Exercises | |
| |
| |
Programs | |
| |
| |
Notes and References | |
| |
| |
| |
Selection and Adversary Arguments | |
| |
| |
| |
Introduction | |
| |
| |
| |
Finding max and min | |
| |
| |
| |
Finding the Second-Largest Key | |
| |
| |
| |
The Selection Problem | |
| |
| |
| |
A Lower Bound for Finding the Median | |
| |
| |
| |
Designing Against an Adversary | |
| |
| |
Exercises | |
| |
| |
Notes and References | |
| |
| |
| |
Dynamic Sets and Searching | |
| |
| |
| |
Introduction | |
| |
| |
| |
Array Doubling | |
| |
| |
| |
Amortized Time Analysis | |
| |
| |
| |
Red-Black Trees | |
| |
| |
| |
Hashing | |
| |
| |
| |
Dynamic Equivalence Relations and Union-Find Programs | |
| |
| |
| |
Priority Queues with a Decrease Key Operation | |
| |
| |
Exercises | |
| |
| |
Programs | |
| |
| |
Notes and References | |
| |
| |
| |
Graphs and Graph Traversals | |
| |
| |
| |
Introduction | |
| |
| |
| |
Definitions and Representations | |
| |
| |
| |
Traversing Graphs | |
| |
| |
| |
Depth-First Search on Directed Graphs | |
| |
| |
| |
Strongly Connected Components of a Directed Graph | |
| |
| |
| |
Depth-First Search on Undirected Graphs | |
| |
| |
| |
Biconnected Components of an Undirected Graph | |
| |
| |
Exercises | |
| |
| |
Programs | |
| |
| |
Notes and References | |
| |
| |
| |
Graph Optimization Problems and Greedy Algorithms | |
| |
| |
| |
Introduction | |
| |
| |
| |
Prim's Minimum Spanning Tree Algorithm | |
| |
| |
| |
Single-Source Shortest Paths | |
| |
| |
| |
Kruskal's Minimum Spanning Tree Algorithm | |
| |
| |
Exercises | |
| |
| |
Programs | |
| |
| |
Notes and References | |
| |
| |
| |
Transitive Closure, All-Pairs Shortest Paths | |
| |
| |
| |
Introduction | |
| |
| |
| |
The Transitive Closure of a Binary Relation | |
| |
| |
| |
Warshall's Algorithm for Transitive Closure | |
| |
| |
| |
All-Pairs Shortest Paths in Graphs | |
| |
| |
| |
Computing Transitive Closure by Matrix Operations | |
| |
| |
| |
Multiplying Bit Matrices--Kronrod's Algorithm | |
| |
| |
Exercises | |
| |
| |
Programs | |
| |
| |
Notes and References | |
| |
| |
| |
Dynamic Programming | |
| |
| |
| |
Introduction | |
| |
| |
| |
Subproblem Graphs and Their Traversal | |
| |
| |
| |
Multiplying a Sequence of Matrices | |
| |
| |
| |
Constructing Optimal Binary Search Trees | |
| |
| |
| |
Separating Sequences of Words into Lines | |
| |
| |
| |
Developing a Dynamic Programming Algorithm | |
| |
| |
Exercises | |
| |
| |
Programs | |
| |
| |
Notes and References | |
| |
| |
| |
String Matching | |
| |
| |
| |
Introduction | |
| |
| |
| |
A Straightforward Solution | |
| |
| |
| |
The Knuth-Morris-Pratt Algorithm | |
| |
| |
| |
The Boyer-Moore Algorithm | |
| |
| |
| |
Approximate String Matching | |
| |
| |
Exercises | |
| |
| |
Programs | |
| |
| |
Notes and References | |
| |
| |
| |
Polynomials and Matrices | |
| |
| |
| |
Introduction | |
| |
| |
| |
Evaluating Polynomial Functions | |
| |
| |
| |
Vector and Matrix Multiplication | |
| |
| |
| |
The Fast Fourier Transform and Convolution | |
| |
| |
Exercises | |
| |
| |
Programs | |
| |
| |
Notes and References | |
| |
| |
| |
NP-Complete Problems | |
| |
| |
| |
Introduction | |
| |
| |
| |
P and NP | |
| |
| |
| |
NP-Complete Problems | |
| |
| |
| |
Approximation Algorithms | |
| |
| |
| |
Bin Packing | |
| |
| |
| |
The Knapsack and Subset Sum Problems | |
| |
| |
| |
Graph Coloring | |
| |
| |
| |
The Traveling Salesperson Problem | |
| |
| |
| |
Computing with DNA | |
| |
| |
Exercises | |
| |
| |
Notes and References | |
| |
| |
| |
Parallel Algorithms | |
| |
| |
| |
Introduction | |
| |
| |
| |
Parallelism, the PRAM, and Other Models | |
| |
| |
| |
Some Simple PRAM Algorithms | |
| |
| |
| |
Handling Write Conflicts | |
| |
| |
| |
Merging and Sorting | |
| |
| |
| |
Finding Connected Components | |
| |
| |
| |
A Lower Bound for Adding n Integers | |
| |
| |
Exercises | |
| |
| |
Notes and References | |
| |
| |
| |
Java Examples and Techniques | |
| |
| |
| |
Introduction | |
| |
| |
| |
A Java Main Program | |
| |
| |
| |
A Simple Input Library | |
| |
| |
| |
Documenting Java Classes | |
| |
| |
| |
Generic Order and the "Comparable" Interface | |
| |
| |
| |
Subclasses Extend the Capability of Their Superclass | |
| |
| |
| |
Copy via the "Cloneable" Interface | |
| |
| |
Bibliography | |
| |
| |
Index | |