April 22, 2018
in
#book reviews

This book was recommended to me by a student, as being a good book for learning about algorithms.

I can see why.

The book is a tour of ten major algorithms, explaining how they work and an overview of how to implement them.

The book is aimed at an introductory level, as a first look at *algorithms* as a thing in their own right. The book assumes the reader knows some basic programming, and can use things like procedures and arrays.

After a short introduction, there are ten chapters, each covering a different algorithm in detail. The final chapter namechecks ten more algorithms, for the interested reader to find out more. (The publisher webpage has the full table of contents.)

The style is very friendly and welcoming. The writing is informal and chatty, and the hand-drawn style of illustrations makes the whole book approachable. By being informal, the reader gets the impression that they can and should really engage with the material.

The algorithms are explained simply, with the text concentrating on the idea behind the algorithm than looking at the detail of the implementation. This generally works, but it may not always warn the reader of the places to be careful (I always have to check my arithmetic carefully whenever I do binary search, to make sure I don't get caught out be some off-by-one error).

The book does a lot to make sure you understand the algorithms. The descriptions are clear and use simple language. There's very little mathematical notation in the book, with the explanations instead relying on simple English and lots of diagrams. I like this, as it's the way I often think about how these things work! This approach may not have the formal rigour of a more mathematical approach, but it's an approach which is much better suited for people *learning* about these things for the first time: the rigour can come later, once you've got a solid grasp of the concepts behind it.

The book does what it sets out to do: explain the algorithms. What it doesn't do is much on how to identify which problems could be solved by these algorithms, and how to adapt the algorithm as presented here to solve these additional problems. The chapters on graph search and dynamic programming are where this is most apparent.

I don't mean to single out this book for this flaw: just about every book on algorithms does the same thing. You need to look a lots of different problems and think about how to solve them.

While there are some questions in the book, they're mainly aimed at checking your understanding of what's just been presented, rather than prodding the reader to look beyond that material.

I really like this book. It's a good and gentle introduction to algorithms. It covers a lot of the basic ideas, such as divide-and-conquer, dynamic programming, big-*O* notation, inductive proofs, and so on. The algorithms are clearly explained, and there's source code that implements them all (in Python).

On its own, this book won't prepare you for everything you need to know about algorithms. For that, you need to look at the algorithms in a bit more depth, and particularly you need to see how they apply to different problems than the simple use cases in the book.

In other words, like most things in programming, really understanding algorithms requires using them in anger, rather than just reading about them.

I got this book from the publisher as an inspection copy. There was no obligation on me to provide a review.

Aditya Y. Bhargava (2016) Grokking Algorithms: An illustrated guide for programmers and other curious people, Manning publications, ISBN 9781617292231.