In preparation for my upcoming masters program I decided to read up on algorithms. For context I would consider myself as having no/ negligible prior knowledge of algorithms, despite having been coding for the past few years. I did some research on books with a gentler learning curve, shortlisted 2, and fortunately found them at the library. Here’s what I thought of them.
Grokking Algorithms – An illustrated guide for programmers and other curious people by Aditya Y. Bhargava
The title’s pretty self explanatory. It’s a very visual, very approachable read on algorithms, in my opinion suitable for anyone with an interest. Apart from illustrations of how specific algorithms work, there are also code samples for implementing the algorithms in Python, if that is of interest. At some points, however, I wished the book would go a little deeper, so if you’ve already had some experience or knowledge with algorithms this book may be a little too basic (and the next one might be more suitable). It’ll also not make you feel well versed in algorithms, if that’s what you’re looking for, but instead it’s more of an appetizer on algorithms.
Chapters in Grokking Algorithms:
- Introduction to algorithms
- Selection sort
- Hash tables
- Breadth-first search
- Dijkstra’s algorithm
- Greedy algorithms
- Dynamic programming
- K-nearest neighbords
- Where to go next
Algorithms Unlocked by Thomas H. Cormen
I started on Algorithms unlocked after finishing Grokking Algorithms. The author, Thomas H. Cormen, is also one of the authors of the popular algorithms textbook, Introduction to Algorithms, also known as CLRS after the authors. Algorithms Unlocked, as emphasized by the author, is quite the opposite of Introduction of Algorithms, while also pretty complementary. Algorithms Unlocked (somewhat) gently introduces algorithms in (somewhat) layman terms, with helpful visuals occasionally. If you’re looking for even more, Cormen provides the relevant chapters in CLRS at the end of each chapter for further reading. I must admit I got lost somewhere in the middle, but probably managed to even got that far after the little bit of basics after Grokking Algorithms. The book uses pseudo code to implement the algorithms.
If you’ve had previous basic experience with algorithms but not in depth, this book may be more suitable for you. I think it may difficult for anyone with no prior algorithms knowledge to get through it on the first try. But with a little bit of basic understanding, this could be the next stepping stone to get a little more depth on the topic. If Grokking Algorithms was an appetizer, Algorithms Unlocked would be something between the appetizer and the starter.
Chapters in Algorithms Unlocked:
- What are algorithms and why should you care
- How to describe and evaluate computer algorithms
- Algorithms for sorting and searching
- A lower bound for sorting and how to beat it
- Directed acyclic graphs
- Shortest paths
- Algorithms on strings
- Foundations of cryptography
- Data compression
- Hard? Problems
Books to read for an introduction to algorithms
In terms of length both are pretty manageable at around 200 pages. If you’re starting out totally from scratch or need a refresher I’d recommend Grokking Algorithms. If you’re looking for a little bit more depth, then Algorithms Unlocked might be better. Grokking Algorithms goes for a little more breadth, and Algorithms Unlocked a little more depth. Nonetheless both are good introductions to the vast and intriguing field.
I often don’t learn full topics from one source, but rely on multiple sources describing the same thing differently to be able to understand the topics better. Hence I found it helpful to read both (Grokking Algorithms before Algorithms Unlocked), though I might a few more rounds or sources to be able to say I have a basic understanding of algorithms. For now, I’d say that I now have a little bit of awareness of basic terminology and concepts in the field of algorithms. A big step from where I was, with an ocean in front of me.