Grokking algorithm: Book Review

Grokking algorithm - An illustrated guide for programmers and other curious people is the book by Aditya Y. Bhargava about understanding algorithms. The book is different from other algorithm books. The book explains the chosen concepts with illustrated guide like cartoons, xkcd and doesn’t let the followers lost in the sea of mathematical formulas or procedure.

The book discusses a handful of foundational topics on algorithms like Big O notation, Binary Search, Sorting, Recursion, Hash Tables, graphs, greedy algorithm, dynamic programming. Here is the link to Table Of Contents. The book is straightforward and easy to follow. The pictures with detailed walkthrough make learning algorithm fun; lively and joyous. The book covers multiple worked out (pictures!) problems for harder concepts like Breadth-first search and knapsack problems.

Here is a picture, solution for a knapsack problem. Consider you’re a robber(I know you aren’t one in real life) and broke into a store with a knapsack capacity 4lbs(No metric system :-(). There are three items stereo, laptop, guitar of different weight and worth. Come up with an algorithm to steal maximum valuable elements that fit in the knapsack.

Here is how worked out solution looks


If you are aware of dynamic programming, explanation, pseudocode may fit on a page, or two and solution in Python programming language may have 50 lines. The worked out solution spans across nine pages with detailed steps and data structures progression at each step! The explanation with images makes learning algorithm exciting and less frightening.

Here is a free version of breadth first algorithm. All the source code and images used in the book is available Github. The cool part is images are available under free for non-commercial use. If you’re teaching algorithm, you can use them in your class!

The book has over 400 pictures and not a reference book but a good one to get started on algorithms.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.