Algorithms in a Nutshell
A desktop quick reference

Before picking an algorithm know what problem you're trying to solve.

By: Staff


Algorithms in a Nutshell is a book aimed at programmers who need practical examples of how to use them to solve problems in their software. As the authors say right in the beginning, they didn't want to write a book that was either too abstract or too focused on solving a particular problem. As they put it, the problem with the former is that, except for the simplest examples, the pseudo-code doesn't provide enough help turning that into actual working code; while the later is often too closely tied to the problem being demonstrated so the coder has to figure out how to separate the general algorithm from the specific example. Instead the approach they took is to teach the reader to figure out what they need, what algorithms are available to solve problems, and what to do when there isn't an apparent solution available.

Finding what you need in the first place is a critical step, and it's addressed in several places in the book; chapter 11 mentions the principal "know your data", that pretty much sums up the idea that you have to know what you want to accomplish before picking a specific algorithm. As an example, the sorting chapter shows a number of different algorithms and points out cases where the simpler to write ones (i.e. potentially less bugs to hunt down) might be fine for a situation as long as the data set isn't too large. Once you know how to define what you are looking for, the next step is finding the tool to solve it.

The middle section covers about 35 different algorithms in the areas of sorting, searching, graph algorithms, path-finding, network flow algorithms and computational geometry. Each algorithm is explained along with some variations and optimizations that are commonly done. One interesting feature of the book is the fact-sheets that provide a graphical overview of the algorithm being discussed including some pseudo-code, O-notation and some performance and implementation notes, e.g. brute-force (these icons are explained on pages 41-43) that give a quick overview of the algorithm being discussed.

Finally the book discusses what to do when there isn't an apparent solution. The advice given is to do two things: figure out what you are trying to solve ("know your data") and break your problem down into smaller, solvable problems.

It took me a bit of time to find the source code mentioned in the book, eventually found it in the "Releases" folder along with code from an O'Reilly blog on algorithms by the same authors - which also explained the meaning of the name (ADK: Algorithms Development Kit) used for the source code. The code is provided in various languages, mostly C/C++ and Java, with some Ruby in places, mostly as a comparison. The layout reminds me a bit of the "Hacks" series of books, it's small format, about 350 pages black/white/gray layout. I'd recommend this book as a good reference.


Date published: 30-Jan-2009





CakePHP Applications Development

Learning the CakePHP 1.2 framework though examples.

Code Craft

A fun read and practical advice on writing good code.

Prototype and script.aculo.us

Using the Prototype and script.aculo.us Javascript libraries to simply your life.

PHP and MySQL Web Development

Programming with PHP and MySQL with security in mind.

Learning jQuery 1.3

Learning to use jQuery to build better websites, though examples and popular plug-ins.


2017 YYZTech

For American computers stores, visit: AmericanComputerDealer.com