Author: Thomas H. Cormen
Publisher: MIT Press
Audience: General readers interested in Computer Science
Reviewer: Mike James
An easy to read book about algorithms. What could be better reading for a programmer - or a non-programmer?
The promise of Algorithms Unlocked is that it will explain the world of algorithms to anyone wanting to know. To quote from the back cover:
Have you ever wondered how your GPS can find the fastest way to your destination, selecting one route from seemingly countless possibilities in mere seconds? How your credit card account number is protected when you make a purchase over the Internet? The answer is algorithms. And how do these mathematical formulations translate themselves into your GPS, your laptop, or your smart phone? This book offers an engagingly written guide to the basics of computer algorithms.
This sounds exciting.
The first chapter starts off with the question "What are algorithms and why should you care?" This is answered in plain English until we get to page 3 when a square root of n pops up. I'm not frightened of algebra, but many readers find it off-putting and you need to know that from page 3 on this book has a lot of algebra per page. For many readers this is not a problem, but for them the problem is that much of the text is aimed at an audience very much lower in IQ requirements. Neither level of presentation is a problem, but together they might be.
Chapter 2 tackles the elephant in the room - the need for a programming language to describe algorithms. The solution adopted is to stick to pseudo code and try to imagine it is just like plain English. By the second page we have arrays and array notation A[i] by the forth page we have a for loop. And the text on next the page is looking very symbol heavy. The last part of the chapter deals with running time analysis including big O notation. Before we hit the end of the chapter we have loop invariants and recursion - this is not a complete beginner's book despite the toned-down language used in many paragraphs.
So by Chapter 2 we can conclude that this is a terrible book? No, not a bit of it. It is a really good read, but only if you are up to taking in the details of the algebra and the programs. If you can then it is a really good book that will tell you much that a more academic book would make much more inaccessible.
Chapter 3 explains what every programmer should know about the theory of searching and sorting from binary search to Quicksort. Chapter 4 extends this and looks at lower bounds on comparison and counting sorts.
Chapter 5 is called Directed Acyclic Graphs and again this give you evidence that the book isn't aimed at the non-technical reader. If it was then the chapter would be called "Networks" or even "Social Networks" to try and persuade the reader that it's cool. It is but only if you are into Dijkstra's algorithm with a side order of Bellman-Ford and Floyd-Warshal algorithm which are all covered in chapter 6. Again the tone of the book is very mathematical with matrices and some longish programs.
Chapter 7 is about string algorithms, including longest common subsequence and string transformations. This is an area that has become very interesting of late due to its application in working with DNA sequences.
Next we have a chapter on cryptography, including RSA and random number generation, and on on data compression, which covers basic Huffman coding and works its way to LZW, which is the basis of zip and other compression applications.
The final chapter is called "Hard? Problems" and, you guessed it, is about the traveling salesman problem, NP v P, NP complete, NP hard and undecidability. This is the most theoretical of the chapters but as long as you have some background in algebra and some idea of what computer science is all about you will love it.
The bottom line is that this is not the book you should rush out to buy as a present for you nearest and dearest - unless they happen to be a math-capable programmer. The ideal reader is probably a first year, or prospective, computer science student or the programmer who wants to get an easy-to-read view of the subject.
It clearly is possible to write a book that explains algorithms for the general reader - mainly by leaving out runtime analysis and simply supplying the broad ideas - but this isn't it. If it goes to a second edition then I would suggest taking out some of the "baby talk". If you need it explained like that you arent' going to code anyway.
Even so, if you are up for the math and happy with pseudo code, then this is good starting point and an entry to reading the author's more grown up book "Introduction to Algorithms".
Introduction to Algorithms