Jump to ratings and reviews
Rate this book

Grokking Algorithms An Illustrated Guide For Programmers and Other Curious People

Rate this book
An algorithm is nothing more than a step-by-step procedure for solving a problem. The algorithms you'll use most often as a programmer have already been discovered, tested, and proven. If you want to take a hard pass on Knuth's brilliant but impenetrable theories and the dense multi-page proofs you'll find in most textbooks, this is the book for you. This fully-illustrated and engaging guide makes it easy for you to learn how to use algorithms effectively in your own programs.

Grokking Algorithms is a disarming take on a core computer science topic. In it, you'll learn how to apply common algorithms to the practical problems you face in day-to-day life as a programmer. You'll start with problems like sorting and searching. As you build up your skills in thinking algorithmically, you'll tackle more complex concerns such as data compression or artificial intelligence. Whether you're writing business software, video games, mobile apps, or system utilities, you'll learn algorithmic techniques for solving problems that you thought were out of your grasp. For example, you'll be able to:
Write a spell checker using graph algorithms
Understand how data compression works using Huffman coding
Identify problems that take too long to solve with naive algorithms, and attack them with algorithms that give you an approximate answer instead
Each carefully-presented example includes helpful diagrams and fully-annotated code samples in Python. By the end of this book, you will know some of the most widely applicable algorithms as well as how and when to use them.

256 pages, Paperback

First published January 1, 2015

1,719 people are currently reading
11.4k people want to read

About the author

Aditya Y. Bhargava

2 books218 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
2,744 (54%)
4 stars
1,720 (34%)
3 stars
433 (8%)
2 stars
77 (1%)
1 star
23 (<1%)
Displaying 1 - 30 of 665 reviews
Profile Image for Maru Kun.
221 reviews547 followers
January 8, 2022
Studying algorithms is a lot like studying accountancy - profoundly boring on the surface and still quite boring if you dig beneath. However, if you spend a lot of effort and dig down far enough algorithms can become mildly interesting, if you've got nothing else better to do.

This is an excellent book on algorithms that succeeded in making them mildly interesting, which is the best one could ever hope for. The book is aimed at the beginner but also touched on more advanced topics and algorithms. It is well written, takes you patiently through required steps and includes some appealing pictures and diagrams. I have finally lost my fear of hash tables and graphs.

The book also includes python code with simple implementations of the algorithms and at the end of it I felt confident that I could code my own. I can't of course, but at least I felt that I could, which is much better than the overwhelming feeling of blackest despair I usually get after closing an algorithm book.
Profile Image for Tim.
8 reviews1 follower
September 22, 2017
Professional programmers aren't going to learn anything new from this book, but it was a fun read regardless. What struck me as great about this book, is it reads like an ELI5 about algorithms and data structures. If nothing else, it's a great way for one to learn how to teach algorithms to others who aren't in the industry. This is a must read for anyone that's learning to code.
Profile Image for ☘Misericordia☘ ⚡ϟ⚡⛈⚡☁ ❇️❤❣.
2,517 reviews19.2k followers
December 24, 2020
A great approach to learning the basics about algorithms in a visual way. Hashing, graphs, greedy algorithms, P vs NP, dynamic programming, MapReduce, sorting and recursion are just some of the topics made accessible for someone who isn't a programmer.
Another cool point is that while programmers won't learn much (or even anything) new from here, they still could learn how to explain some of the more abstractish concepts in a very visual, simple and entertaining way.
Also, a great approach to condencing the difficult stuff into simple ideas.
Profile Image for rachkatr.
89 reviews14 followers
December 31, 2016
The best book I've ever read on algorithms. Also the only book I've ever read on algorithms, but probably for a good reason.
Profile Image for David.
72 reviews3 followers
May 25, 2021
A quick engaging introductory read on an important topic. While I'd love to think that I could pick up some authoritative algorithm textbook, my experience self-studying suggests I might not get that far. I still have a pdf of SICP that I've read all of two pages of despite the universal acclaim that book gets.

That being said, Grokking Algorithms is pricey at $44, especially for something you could read in an afternoon. My copy sat around a few months before I read it (albeit in the book eating climate of New Orleans), and the pages were falling out as I finished reading. Pretty shoddy. It has less value as a reference than one might think because it only covers a handful of algorithms. I'd recommend getting it at the library if you're a self-taught programmer wanting a gentle intro to algorithms or are experienced and want a refresher.

Podcast interview with the author: https://talkpython.fm/episodes/show/8...

ETA: I was on a second date at a coffee shop, and the conversation had already gotten stale. My date used to play chess competitively and seemed generally interested in puzzles and logic, so I got this book out of my bag and did some array algorithm problems with her on graph paper. (In hindsight - the low-point of my programming monomania.) She took to it and was much more entertained then than in our previous conversations. We never did see each other again, and I never got my book back. I hope she took up programming though, or at least didn't go to law school like she'd considered, or maybe she even gave puppeteering a serious go as she'd also considered. I do miss this book for its succinct explanation of some elementary algorithms and really wished I'd had it for ramping up into the Leetcode grind.
Profile Image for Tomy Jaya.
27 reviews4 followers
September 25, 2017
I absolutely love the author's visual approach to teaching algorithms. Coupled with a plethora of examples, the bite-sized chapters in this book are ideal for people like me to follow. I would highly recommend this book not only to beginners, but also to experienced developers who want to refresh their algorithms knowledge and ultimately, make it stick.
Profile Image for Salem.
231 reviews5 followers
September 12, 2020
استيعاب الخوارزميات ... دليل مصور للمبرمجين والفضوليين
~~~
الخوارزميات -نسبة للخوارزمي- هي مجموعة من الخطوات الرياضية لحل مشكلة ما. بالإضافة
لهياكل البيانات؛ فالخوارزميات هي أساس علوم الحاسب وتطبيقاته المختلفة من قواعد بيانات
لأنظمة التشغيل والشبكات وحتى الذكاء الصناعي وتعلم الآلة. ومع أهمية الخوارزميات
إلا أنها تعتبر من المواضيع غير المحببة للمشتغلين بالحاسب؛ لأنه غالبا ما يتم تقديمها بصورة
معقدة وجافة، فيكرهها المتعلم قبل أن تتبين له الفائدة و يتعرف على جمالياتها.

جاء الكتاب كمقدمة مبسطة للخوارزميات وهياكل البيانات، وهو مملوء بالصور
والخربشات التوضيحية التي تعين على إيصال الفكرة. أنصح بقرائته للمبرمجين خاصة
والمشتغلين بالحاسب عامة.
4 reviews
October 3, 2016
Dont have a CS background and ever wondered what that O(logn) stood for. Fear not, Aditya has your back covered. I have tried several times to learn the basic algorithms and their respective time complexities but have failed miserably. The illustrations and the code samples in Python make it much more lucid to grasp the concepts that are otherwise very ambiguous usually covered with a lot of complexity math. Kudos to Aditya now I am ready to tackle the stanford course by Tim Roughgarden.

Profile Image for Eugene.
15 reviews1 follower
June 9, 2024
It is an entertaining and content-dense book. If you build software it is a must-read.
I especially liked the described approach to performance and the overview of more complex algorithms that I never used in practice: dynamic programming, linear programming, and hyperloglog.
Profile Image for Bharat.
140 reviews
June 8, 2016
The visual way of explaining algorithms as seen in this book is very appealing and pretty good and one can easily breeze through the content. Human brains grasp visual narrations better. Can be a starter book before delving into more advanced and books such as CLRS.
Profile Image for SeyedMostafa Meshkati.
63 reviews25 followers
August 30, 2021
This book is so good for reminding previous knowledge about DS and algorithms and is also good to be an introduction for people who are not familiar with this stuff, but it's not enough for both parties.
If you are going to learn the DS and algorithms for the first time, you should read other sources to learn that, because the book is not covering them all. Like it talks about BFS but doesn't mention DFS, or it doesn't have many examples about each algorithm.
I think the main benefit of the book is its simple explanations, but it covers less than you think.

In Persian:
برای یادآوری دانسته‌ها کتاب خیلی خوبی هست، همینطور آموزش ساده‌ی ساختمان داده و الگوریتم برای کسایی که با این مسائل آشنا نیستن، اما برای هر دو گروه کافی نیست! اگر برای اولین بار هست که با الگوریتم و ساختمان داده آشنا می‌شید، به نظرم بعد از این کتاب حتما باید یک کتاب سورس رو هم مطالعه کنید. چون کتاب به صورت خوبی کاور نمی‌کنه موارد رو. مثلا در مورد الگوریتم بی‌اف‌اس صحبت می‌شه، اما در خصوص دی‌اف‌اس صحبتی نمی‌کنه. همینطور در باقی موارد هم مثال‌ها خیلی محدود هستن.
به نظرم نقطه‌ی قوت اصلی این کتاب، ساده توضیح دادنش هست. اما خب به همین خاطر خیلی کمتر مسائل کاور می‌شن.
Profile Image for Hưng Đặng.
127 reviews66 followers
March 16, 2020
Algorithm is difficult. The word itself intimidates me-someone who doesn't have a CS degree. Its translation to my mother tongue doesn't help, makes me worried sometimes. That's why this book is such a life-saver because I get what it wants to say.
I don't think I have reached a higher level of understanding algorithm because at this moment I still can't implement some of them on my own. Even with things I believe that I can do like writing an example of greedy or breath-first algorithm, I'm not confident that I will solve them without breaking a sweat. But surely this book gave me a foundation and topics for further studying and investigating.
It's still quite disappointing because with such a friendly language like Python and many visualizations, it still took me 3 months to finish.
Now my next book is "Structure and interpretation of Computer Program" which code is written in Lisp. I wonder how much time it will take me.
Profile Image for Diego Garcia.
21 reviews1 follower
January 30, 2018
A simple and nice introduction to most popular algorithms, if you wanna to know what is an algorithm and which ones are most popular, that is a good book, but if you're looking for a book to help you to write and deep understand algorithms, take a look for other books.
Profile Image for Alireza Heydari.
35 reviews4 followers
April 17, 2022
Having real life examples is the cherry on the cake. It will map life problems into math problems and then tries to say how can we provide an algorithm for it.

There were some sections that the definition was not scientific or based on the correct engineering (for example he tried to explain hash function with simplifying it and then correct it later which was strange). So don't consider it as a source like an engineering book.

Last chapter (where to go next) is a must read. It helps to know a variety of ideas around the algorithms and tries to make you curious about them.
Profile Image for زياد.
4 reviews
October 3, 2024
Do you want to treat yourself to learning algorithms in the same way that you would read your favorite novel? If so, this is the book you need!
Profile Image for Siarhei Krukau.
90 reviews6 followers
February 14, 2023
Although the book is just fine, it would be a lie to rate it higher than Cormen's or Jeff Erickson's creations (or other notable authors in the field). It's just more shallow. It's a pulp fiction from the world of algorithms. I doubt anyone would be able to write a decent algorithm — even one of the mentioned here — after reading this book.

The author explains only the first few algorithms. The depth of the explanations faints as the book progresses. For the second half of the book sometimes you dont't even get the complexity (big-O notation) of the algorithms described, not to say about Python or pseudo-code.

Well it's short and fun to read.
Profile Image for Alex.
168 reviews17 followers
July 4, 2016
The book is OK as an introduction to algorithms, though I felt that the difficulty level is uneven, some easy parts were chewed on way too much and some difficult part were glossed over. Also sometimes there are some references to the algorithms or concepts that haven't been explained yet, but that maybe because the book is still in 'beta' (I've got it via MEAP program).
Profile Image for Meirav Rath.
247 reviews4 followers
November 19, 2018
This book was so much fun!!
It's basically "algorithms for dummies, with cute drawings" but, by go, it was the first technical book I could read without constantly fighting with myself to focus.
Guess I'm a dummy (who needs cute pictures to stay focuses).
Profile Image for Ghadeer.
177 reviews40 followers
April 16, 2022
► Recommended By:
Prof. Mohamed Hammad

► Read with:
Group: She in Tech
The group has provided an Arabic translation of the book in addition to online meetings to discuss all chapters → Github Repo

► Review:
I can't recommend this book enough! I don't consider myself at the very beginning of learning programming but I really learned a lot from this book. The simple illustrations delivered the idea quickly. I used to find Graphs a very complicated topic and I wasn't able to understand it pretty well. The explanation of the book was really helpful. I totally recommend it to total newbies and for people who know some foundation in programming. Was really enjoyable reading it.
Profile Image for Lamia.
119 reviews42 followers
August 3, 2019
Świetny wstęp do algorytmów! Bardzo plastyczne, działające na wyobraźnie przykłady ich użycia. Polecam!
Profile Image for Justin Leatherwood.
16 reviews4 followers
September 21, 2020
Great refresher on algorithms and data structures! Was much more casual than a standard coding/CS textbook, which was a very nice way to approach a lot of normally dry topics. Was able to read in less than a week. If you tried to learn the same information searching around online, you'd find it very dull (what i was doing before I was told about the book. Definitely not a deep dive, but that's more than okay for the value I got out of it. There were a lot of good examples in the Greedy and Dynamic Programming chapters, but those are complex topics and I can tell you I still need to do some more digging and practice on those to really be able to be effective at knowing when to use them, how to use them, etc...s
Profile Image for Vishwanath.
44 reviews6 followers
February 25, 2017
Refreshing new presentation of algorithms. I was intrigued by the visual premise of the book especially at a time when I was looking for a refresher on algorithms. This book is an enjoyable journey through a usually dry topic and the visual illustrations by the author help reinforce concepts.
Its a bit light on examples through actual code but those examples can be easily researched online. The big O notation topics are especially useful.

23 reviews10 followers
December 1, 2015
I read this through the Manning MEAP program. I thoroughly enjoyed it. My only complaint really is that I wish the tree section could have been longer but that might be changed by publication time. I'm a long time programmer with no degree so I missed a lot of the basis in algorithms others have. This is not a textbook but I got a great intro to a lot of important algorithms.
Profile Image for Tony Poerio.
212 reviews12 followers
April 25, 2016
This book gives some really excellent and concise descriptions of problems that... when you learn them from your CS professor... seem absurdly (and almost purposely) harder than they need to be. I also really like Aditya's illustration style, and that was what drew me in. It reminds me of "Learn You a Haskell", but focused on Algorithms. Worth the the read.
Profile Image for Ahmed Ismail.
70 reviews
December 27, 2020
great book to start learning Algorithms, easy and fun,
even if you are not a programmer u gonna love that book,
it just makes u think logically,
my problem with that book, that it doesn't focus on the implementation with code ,
there's no much code here,
even the exercises does not have code!
highly recommended for beginners who want to get an overview about algorithms.....
Profile Image for Julia.
351 reviews18 followers
December 7, 2021
Clear explanations and fun illustrations of some useful algorithms to know. Suitable for beginners or to refresh your memory if you've already studied algorithms. I found a few errors in the book, and there were a couple concepts (like P vs. NP problems) which felt like they were too simplified (although I could just be out of touch).
Profile Image for Eugene Maysyuk.
6 reviews
September 14, 2021
In first half of the book author provides deep explanation for each algorithm but in second part of the book there are only brief and superficial explanations. The book is easy to read.
Profile Image for Vanya Hrynkiv.
208 reviews5 followers
August 20, 2024
Гарна книга для знайомства, повторення та заглиблення в алгоритми, читати цікаво, аж ніяк не нудно
Profile Image for Mohammad Hossein.
24 reviews3 followers
November 29, 2024
به نطرم برای کسی که میخواد یه آشنایی ابتدایی ولی با ساختار درست با الگوریتم پیدا کنه کتاب مناسبیه فقط به نظرم میتونست مثال‌های کاربردی بیشتری توی بعضی از فصل‌ها داشته باشه.
Profile Image for Chris Nitsas.
44 reviews14 followers
October 28, 2022
A quick, illustrated introduction or refresher for some common but fundamental algorithms and data structures.

The book opens with a real-life application of one of my favorite algorithms: Search for a name in a phonebook using binary search.

The next chapters talk about Big O notation (for comparing how different algorithms scale), sorting, recursion, Quicksort, the divide & conquer paradigm, why Quicksort is often faster than mergesort even though it has a worse worse case complexity (O(n^2) vs O(log n)), breath-first search, Dijkstra's algorithm plus a mention of the Bellman-Ford algorithm for when we have negative weight edges, greedy algorithms, approximation algorithms, NP-compete problems, dynamic programming, and K-nearest neighbors for classification & regression (i.e. predictions). The last chapter ("Where to go next") also mentions the Fourier transform, parallel algorithms, MapReduce, the SHA algorithms, locality-sensitive hashing (Simhash), Diffie-Hellman key exchange, linear programming, and their uses, but the reader will have to search for details elsewhere.

In between and often hand-in-hand with the above algorithms we meet some data structures. Arrays, linked lists, and hash tables are covered in enough detail and we get examples of where each one shines. We also meet stacks, queues, and sets in shorter sections. The chapter about graph algorithms shows us how to implement a graph using hash tables that point from each node to a linked list (or array) of its edges. Finally, "Where to go next" mentions trees, inverted indexes, Bloom filters, HyperLogLog, and their uses, but without detailing them.
Displaying 1 - 30 of 665 reviews

Can't find what you're looking for?

Get help and learn more about the design.