REVIEW - Learning Algorithms - A Programmer's Guide to Writing Better Code


Learning Algorithms - A Programmer's Guide to Writing Better Code


George Heineman




O’Reilly Media (2021)




Emyr Williams


January 2022




There are a lot of books on data structures and algorithms on the market at the moment, and a majority of them either assume a strong knowledge of maths or computer science. Well, here’s one that assumes neither, but explains things in a clear and easy to follow way.

While the subtitle of the book is A programmer’s guide to writing better code, it doesn’t assume that the reader of the book has gone through the traditional route of become a programmer (if there is such a thing anymore?)

Python is the language of choice for the book, and it’s an excellent choice given its relatively low barrier of entry, and also its English-like syntax. I found it equally as easy to write the samples in Go or C++, but I mainly did it in Python so I could follow exactly what was going on.

The structure of the book is well laid out too, with each chapter having a series of exercises, which allows the user to put in to practice what they’ve learned.

The first chapter, entitled ‘Problem solving’, walks the reader through what an algorithm is and what it’s used for, not just with a wall of text and complex looking math symbols, but with real practical code, which the reader can write and play with themselves. It walks the programmer through how they can work out the best and worst case scenarios for the example algorithm using the code, which is a theme throughout the book.

The second chapter, ‘Analyzing Algorithms’, is where the Big O notation is explained, again replete with practical examples. I particularly enjoyed this chapter, as I struggled to get my head around this topic. But the author walks you step by step through how to analyse your algorithms, as well as understand how they affect the performance of your programs.

This sets up the reader for the rest of the book, as the author walks the reader through hashing algorithms, heaps, sorts, binary trees and graphs.

It is an excellent book and I found writing the code samples great fun. It also appealed to me personally as I don’t have a Maths background or a Computer Science degree, so I found the language in the book very approachable, and helpful in a way I’ve not come across with a lot of programming books.

It’s certainly a book I’d recommend not just for someone who’d just started their programming career, but for seasoned hands who wanted a refresher too. If you’re after something more wide-ranging then there are other books out there, but if you’re after something you can get going with quickly, then I don’t think you’ll find much that can top this book.