Overview
In his book, Grokking Algorithms: An Illustrated Guide for Programmers and Other Curious People, Aditya Bhargava tries to explain several basic algorithms in a very visual and graspable way.
For every algorithm presented, there are several graphics the reader can follow along. This makes understanding these algorithms much easier since you can walk through them without writing a single line of code.
That being said, there are short code examples for each algorithm. Since they are written in Python, they look very similar to pseudo-code and it should be easy to implement them in any other language.
Content
In the first chapter, Introduction to algorithms, the author gives an overview of the algorithms you will learn in this book and what to expect from this book. Then he explains Binary search and introduces the reader to Big O notation.
In the second chapter, he talks about Arrays and Linked lists and then presents the Selection sort algorithm.
The third chapter deals with Recursion and how it affects the call stack of a program.
Having covered these basic topics, chapter 4 dives into the Divide & conquer approach to solving problems and explains it using the Quicksort algorithm. This is followed by a comparison of different sorting algorithms and some more explanations about Big O notation.
In chapter 5, Aditya Bhargava talks about Hash tables, their use cases, collisions and performance considerations.
In chapter 6, the reader is introduced to graphs and the Breadth-first search algorithm to find shortest paths. While graphs and their algorithms can be considered more advanced, the author does a great job of explaining them with extensive use of visualizations.
Chapter 7 presents Dijkstra’s algorithm, again in a very visual and graspable manner and shows when and when not to use it.
The next chapters deal with even more advanced concepts.
Chapter 8 presents several NP-complete problems such as the knapsack-, Traveling salesperson- and set-covering problem. It also shows how they can be “solved” using so-called Greedy algorithms.
In chapter 9, the author talks about Dynamic programming and how it can be applied to some of the problems mentioned above.
Finally, chapter 10 gives a short but to the point introduction to Machine learning and where it can be applied. The presented algorithm is K-nearest neighbors.
In the last chapter, the author gives the reader a roadmap of more advanced algorithms to look up to dive deeper into algorithms.
Who Is This Book For?
This book is clearly targeted towards beginning programmers and people without a degree in Computer Science. Personally, I think it would make a great book as a companion and/or preparation for university classes about basic Algorithms and data structures. Advanced Software Engineers or readers with a degree in Computer Science probably won’t get much out of this book, however, it can be a good refresher and allow you to catch up on some of the basics you missed. If you are already well versed in algorithms, you won’t find anything new in this book and better look for more advanced literature.
If you are new to algorithms, I highly recommend you read this book.
Summary
I give this book 5 out of 5 stars because of the author's awesome writing style and all the visualizations, the layout of the book and the order in which the algorithms are presented. While it won’t give you a deep dive into the underlying theory and details of the covered algorithms, the book will prepare you for reading advanced books such as Algorithms by Robert Sedgewick or Data structures and algorithms in Python.