Synopses & Reviews
Creating robust software requires the use of efficient algorithms, but programmers seldom think about them until a problem occurs. Algorithms in a Nutshell describes a large number of existing algorithms for solving a variety of problems, and helps you select and implement the right algorithm for your needs -- with just enough math to let you understand and analyze algorithm performance.
With its focus on application, rather than theory, this book provides efficient code solutions in several programming languages that you can easily adapt to a specific project. Each major algorithm is presented in the style of a design pattern that includes information to help you understand why and when the algorithm is appropriate.
With this book, you will:
- Solve a particular coding problem or improve on the performance of an existing solution
- Quickly locate algorithms that relate to the problems you want to solve, and determine why a particular algorithm is the right one to use
- Get algorithmic solutions in C, C++, Java, and Ruby with implementation tips
- Learn the expected performance of an algorithm, and the conditions it needs to perform at its best
- Discover the impact that similar design decisions have on different algorithms
- Learn advanced data structures to improve the efficiency of algorithms
With Algorithms in a Nutshell, you'll learn how to improve the performance of key algorithms essential for the success of your software applications.
Creating software systems involves more than simply writing a program. It requires creativity and technical excellence. Technical excellence includes the ability to make programs robust and efficient. Efficient algorithms are at the heart of all but the most trivial programs. Programmers, however, seldom think about the algorithms in their programs until they encounter problems. Many programmers do not have a background in algorithm analysis and design and if they do, they don't take the time to find the right algorithm for their needs. Algorithms in a Nutshell helps programmers select, analyze, and implement the right algorithms for their particular needs. It provides just enough mathematics to let the reader understand and analyze algorithm performance. The algorithms in the book are based upon the type of problems they address. Each algorithm is presented in the style of a design pattern - an approach, or plan for how to solve the problem accompanied by the information needed to understand why the algorithm is appropriate, how one might determine why the algorithm is the right one, and implementation tips. This is a major benefit to the reader. Just as design patterns for object-oriented design enable developers to use a common language to describe their designs, we believe that providing a pattern language for algorithms can enable similar communication benefits.
About the Author
George Heineman is an Associate Professor of Computer Science at WPI. His research interests are in Software Engineering. He co-edited the 2001 book "Component-Based Software Engineering: Putting the Pieces Together". He was the Program Chair for the 2005 International Symposium on Component-Based Software Engineering.
Gary Pollice is a self-labeled curmudgeon (that's a crusty, ill-tempered, usually old man) who spent over 35 years in industry trying to figure out what he wanted to be when he grew up. Even though he hasn't grown up yet, he did make the move in 2003 to the hallowed halls of academia where he has been corrupting the minds of the next generation of software developers with radical ideas like, "develop software for your customer, learn how to work as part of a team, design and code quality and elegance and correctness counts, and it's okay to be a nerd as long as you are a great one."
Gary is a Professor of Practice (meaning he had a real job before becoming a professor) at Worcester Polytechnic Institute. He went to WPI because he was so impressed with the WPI graduates that he's worked with over the years. He lives in central Massachusetts with his wife, Vikki, and their two dogs, Aloysius and Ignatius. When not working on geeky things he ... well he's always working on geeky things. You can see what he's up to by visiting his WPI home page at:http://web.cs.wpi.edu/~gpollice/. Feel free to drop him a note and complain or cheer about the book.
Stanley Selkow received a BS in Electrical Engineering from Carnegie Institute of Technology in 1965, and then a Ph.D. in the same area from the University of Pennsylvania in 1970. From 1968 to 1970 he was in the Public Health Service at the National Institutes of Health at Bethesda Maryland. Since 1970 he has been on the faculty at universities in Knoxville TN and Worcester MA, as well as Montreal, Chonqing, Lausanne and Paris. His major research has been in graph theory and algorithm design.
Table of Contents
Preface; Principle: Use Real Code, Not Pseudocode; Principle: Separate the Algorithm from the Problem Being Solved; Principle: Introduce Just Enough Mathematics; Principle: Support Mathematical Analysis Empirically; Audience; Contents of This Book; Conventions Used in This Book; Using Code Examples; Comments and Questions; Safari® Books Online; Acknowledgments; References; Part I: I; Chapter 1: Algorithms Matter; 1.1 Understand the Problem; 1.2 Experiment if Necessary; 1.3 Side Story; 1.4 The Moral of the Story; 1.5 References; Chapter 2: The Mathematics of Algorithms; 2.1 Size of a Problem Instance; 2.2 Rate of Growth of Functions; 2.3 Analysis in the Best, Average, and Worst Cases; 2.4 Performance Families; 2.5 Mix of Operations; 2.6 Benchmark Operations; 2.7 One Final Point; 2.8 References; Chapter 3: Patterns and Domains; 3.1 Patterns: A Communication Language; 3.2 Algorithm Pattern Format; 3.3 Pseudocode Pattern Format; 3.4 Design Format; 3.5 Empirical Evaluation Format; 3.6 Domains and Algorithms; 3.7 Floating-Point Computations; 3.8 Manual Memory Allocation; 3.9 Choosing a Programming Language; 3.10 References; Part II: II; Chapter 4: Sorting Algorithms; 4.1 Overview; 4.2 Insertion Sort; 4.3 Median Sort; 4.4 Quicksort; 4.5 Selection Sort; 4.6 Heap Sort; 4.7 Counting Sort; 4.8 Bucket Sort; 4.9 Criteria for Choosing a Sorting Algorithm; 4.10 References; Chapter 5: Searching; 5.1 Overview; 5.2 Sequential Search; 5.3 Binary Search; 5.4 Hash-based Search; 5.5 Binary Tree Search; Chapter 6: Graph Algorithms; 6.1 Overview; 6.2 Depth-First Search; 6.3 Breadth-First Search; 6.4 Single-Source Shortest Path; 6.5 All Pairs Shortest Path; 6.6 Minimum Spanning Tree Algorithms; 6.7 References; Chapter 7: Path Finding in AI; 7.1 Overview; 7.2 Depth-First Search; 7.3 Breadth-First Search; 7.4 A*Search; 7.5 Comparison; 7.6 Minimax; 7.7 NegMax; 7.8 AlphaBeta; 7.9 References; Chapter 8: Network Flow Algorithms; 8.1 Overview; 8.2 Maximum Flow; 8.3 Bipartite Matching; 8.4 Reflections on Augmenting Paths; 8.5 Minimum Cost Flow; 8.6 Transshipment; 8.7 Transportation; 8.8 Assignment; 8.9 Linear Programming; 8.10 References; Chapter 9: Computational Geometry; 9.1 Overview; 9.2 Convex Hull Scan; 9.3 LineSweep; 9.4 Nearest Neighbor Queries; 9.5 Range Queries; 9.6 References; Part III: III; Chapter 10: When All Else Fails; 10.1 Variations on a Theme; 10.2 Approximation Algorithms; 10.3 Offline Algorithms; 10.4 Parallel Algorithms; 10.5 Randomized Algorithms; 10.6 Algorithms That Can Be Wrong, but with Diminishing Probability; 10.7 References; Chapter 11: Epilogue; 11.1 Overview; 11.2 Principle: Know Your Data; 11.3 Principle: Decompose the Problem into Smaller Problems; 11.4 Principle: Choose the Right Data Structure; 11.5 Principle: Add Storage to Increase Performance; 11.6 Principle: If No Solution Is Evident, Construct a Search; 11.7 Principle: If No Solution Is Evident, Reduce Your Problem to Another Problem That Has a Solution; 11.8 Principle: Writing Algorithms Is Hard--Testing Algorithms Is Harder; Part IV: IV; Appendix A: Benchmarking; A.1 Statistical Foundation; A.2 Hardware; A.3 Reporting; A.4 Precision; About the Authors; Colophon;