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

Loading interface...
Loading interface...

About the author

Aditya Y. Bhargava

2 books170 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,037 (54%)
4 stars
1,283 (34%)
3 stars
327 (8%)
2 stars
62 (1%)
1 star
16 (<1%)
Displaying 1 - 30 of 524 reviews
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 Maru Kun.
215 reviews485 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.
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 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
استيعاب الخوارزميات ... دليل مصور للمبرمجين والفضوليين
~~~
الخوارزميات -نسبة للخوارزمي- هي مجموعة من الخطوات الرياضية لحل مشكلة ما. بالإضافة
لهياكل البيانات؛ فالخوارزميات هي أساس علوم الحاسب وتطبيقاته المختلفة من قواعد بيانات
لأنظمة التشغيل والشبكات وحتى الذكاء الصناعي وتعلم الآلة. ومع أهمية الخوارزميات
إلا أنها تعتبر من المواضيع غير المحببة للمشتغلين بالحاسب؛ لأنه غالبا ما يتم تقديمها بصورة
معقدة وجافة، فيكرهها المتعلم قبل أن تتبين له الفائدة و يتعرف على جمالياتها.

جاء الكتاب كمقدمة مبسطة للخوارزميات وهياكل البيانات، وهو مملوء بالصور
والخربشات التوضيحية التي تعين على إيصال الفكرة. أنصح بقرائته للمبرمجين خاصة
والمشتغلين بالحاسب عامة.
Profile Image for David.
43 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.
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 Bharat.
127 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 Hưng Đặng.
109 reviews55 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 SeyedMostafa Meshkati.
49 reviews19 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 Alireza Heydari.
34 reviews3 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 Ghadeer.
141 reviews29 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.
79 reviews36 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.
13 reviews2 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.
42 reviews5 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 reviews8 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 reviews11 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 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 Ahmed Ismail.
67 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 Meirav Rath.
224 reviews3 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 Chris Nitsas.
42 reviews16 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.
Profile Image for Mojtabaavahdati.
20 reviews7 followers
September 15, 2021
An amazing read! If you've learned data structures and algorithms before, but still need to be able to converse about them comfortably, this is the magical book you definitely need to go for.

Pros:
- Makes everything darn simple without sacrificing important nuances.
- It's "comprehensive"! It covers so many DSA topics, and even when there remains some that are not covered, lists them in the final chapter and talks about them briefly to tell you what they are, where they are used and also when you might need them.
- The author gives so many examples of real world non-toy usages of the concepts explained, some of the examples which are from the top companies like Google and Amazon.
- So many helpful analogies and illustrations.
- The chapters are in a perfect order, and also the author creates a wiring(network) of the concepts in the reader's mind by referencing them multiple times after the initial point they've been talked about. For example, you learn about the Binary Search in the second chapter, but even in the eleventh chapter, where the Binary Search Tree is explained, you read about the binary search again. You’ll learn why they are so similarly named while seemingly having quite different structures, and also the pros and cons of each, e.g, the tree is cheaper on inserts, but without giving you the random access.

Cons:
No cons really, I just believe if you haven't learned DSA before, this book is not a good first resource to teach you about it. Although it is thorough, and although it explains things quite simply and brilliantly and shows the code for some of the algorithms as well, I still believe one will benefit the most from it, if they have learned DSA already using the conventional teaching methods, and then use this book to get a recap of everything they have learned(and even more) in a very simple and elegant language.

Thank you Mr.Adit for taking the time to write this book. ;)
Profile Image for dj1vs.
1 review
February 3, 2023
Отличная книга для начального ознакомления с алгоритмами. Каждый алгоритм максимально подробно, со схемами и инструкциями разбирается на наглядных примерах. Читается достаточно легко и интересно.
Но у книги есть минусы: порой разборы достаточно простых концепций занимает уж слишком много места, и разбирается достаточно мало материала: лично я для себя что-то новое подчеркнул в основном только из последней пары глав.
А так же в последних главах автор рекомендует для шифровки паролей устаревший алгоритм хеширования SHA - это серьезная угроза безопасности, если кто-то действительно прислушается к такому совету. Справедливости ради, автор признал ошибку на своей errata странице, но не думаю, что кто-то из новичков стал бы ее читать.
Profile Image for Julia.
284 reviews14 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 Vicki.
485 reviews192 followers
June 28, 2022
Great read and very clear. to get a start on algorithms but would also complement with a couple of meatier readings that will go into the details.
38 reviews2 followers
January 4, 2021
An excellent introductory book, you really don't need any prior knowledge, well you need to be able to read.
66 reviews
February 21, 2022
Good read for beginners to algorithms. And a refresher. But it's not for someone who is already deep into it or wants a deep dive.
Displaying 1 - 30 of 524 reviews

Can't find what you're looking for?

Get help and learn more about the design.