In my career as a software engineer, my job is always more a process of finding a particular solution in a particular context to solve a particular problem. Easy enough, right? Just have to have the right tools and the right parts to get from point A to point B.
Well, you don't always have an easy time finding the right tools or the right parts. That's why I'm always on the lookout for books that can provide not only a set of tools I can use, but also describes the context in which a particular tool should be used.
Algorithms are just one more tool in the toolbox for software engineers and people in other disciplines who write computer programs. The definition of an algorithm is simply a set of rules for solving a problem in a number of steps. When you were in school, teachers used algorithms (covertly or not) to provide a framework for solving problems in math, science, and even English.
In Algorithms in a Nutshell from O'Reilly, George T. Heineman, Gary Pollice, and Stanley Selkow provide not only a range of algorithms to choose from, but a methodology for finding the right one and testing it once you have it implemented.
In Part I, the authors explain why algorithms matter, ways to rate how a particular algorithm works in a particular context, and how to use patterns, languages, and algorithms together to solve a particular domain specific problem. Though the math in some cases was far above my head, readers with a firm grasp of statistics will have a better idea how to use some of the techniques and formulas to better apply these tools to their own problem domains.
Part II walks through six chapters describing six different categories of algorithms:
- Path Finding
- Mapping Network Flow
- and Computational Geometry
Many of these algorithms have been around for a long time, such as the Quicksort, Bucket Sort, Binary and Binary Tree Search. But many others were quite new to me, such as the Graphing algorithm "All Pairs Shortest Path." Having never really needed path finding, network flow, or computational geometry algorithms, they were all new and interesting to me, but without an application to apply them to went over my head.
Part III provides two chapters to help when you've exhausted the other algorithms but still haven't quite found "the one."
"When All Else Fails" provides ways to vary your approach and perhaps use a conglomeration of approaches to achieve results when a single algorithm might not work.
And in the "Epilogue" the authors provide a great set of principles to help guide selecting an appropriate algorithm.
- Know Your Data
- Decompose the Problem into Smaller Problems
- Choose the Right Data Structure
- Add Storage to Increase Performance
- If No Solution is Evident, Construct a Search
- or If No Solution is Evident, Reduce Your Problem to Another Problem that Has a Solution
- and Writing Algorithms is Hard – Testing Algorithms is Harder
Personally, I think this chapter should have been in the first part of the book. It gets to the heart of the matter quickly and succinctly, providing a simple set of guiding principles to help find the right solution.
Overall, this is a great book for developers looking for more tools in their arsenals. As you might suspect, this is not really a book to read cover to cover unless it's for a class. But it provides a clear and well laid out approach to some of the many algorithms that exist today in computer programming. It isn't an exhaustive list, but it certainly provides a great cross-section from which you could continue your search.
I, for one, am happy this book is now on my shelf beside some of my other computer science references on data structures and design patterns. It's a welcome addition to my box of tools.
Be sure to check it out at your favorite bookstore or at Amazon!