The best books for actually learning how to design algorithms

Who am I?

I love pulling back the curtain on how computers work. I want to go from thinking "that's magic" to "that's unbelievably clever but now I understand how it works." Each time I am able to do this feels like a hard-won but therefore meaningful step toward understanding. I want others to experience this empowering shift. I have a PhD in computer science education, and  I want to know what helps people learn. More importantly, I want to know how we can use such discoveries to write more effective books. The books I appreciate most are those that demonstrate not only mastery of the subject matter but also mastery of teaching.

I wrote...

Algorithmic Thinking: A Problem-Based Introduction

By Daniel Zingaro,

Book cover of Algorithmic Thinking: A Problem-Based Introduction

What is my book about?

Knowing how to design algorithms will take you from being a good programmer to being a great programmer. Algorithmic Thinking will teach you how to design your own rocket-fast, correct algorithms. Not interested in wading through proofs and math? Not interested in pseudocode that you can’t run? Not interested in seeing the same examples that you’ve seen in all of the other books? Good—there’s none of that here. You’ll rigorously learn all of the heavyweights that you need to know: hash tables, recursion, dynamic programming, trees, graphs, heaps, union-find, and more. You’ll learn it all in the context of solving programming puzzles. You’ll learn it all from someone who has dedicated their career to helping students learn. It is time for you to finally and truly learn this stuff.

The books I picked & why

Shepherd is reader supported. We may earn an affiliate commission when you buy through links on our website. This is how we fund this project for readers and authors (learn more).

Algorithm Design

By Jon Kleinberg, Éva Tardos,

Book cover of Algorithm Design

Why this book?

I’ve probably spent more time with this book than with any other technical book. It’s one of those books where you can get as much out of it as you like by revisiting the material at increasing levels of depth. I appreciate the conversational but rigorous tone, the solved examples, the false starts, the intuition that the authors build, and the applications of algorithm design to realistic problems. The Maximum Flow chapter is not to be missed.

Algorithms Illuminated (Part 1): The Basics

By Tim Roughgarden,

Book cover of Algorithms Illuminated (Part 1): The Basics

Why this book?

How do we know whether an algorithm is correct? While intuition is helpful, for tricky algorithms nothing beats the formal proof. But I don’t want a proof for proof’s sake: I want it to deepen my understanding of the algorithm. The proofs in this book series are the best I’ve seen: they are self-contained, described step by step, and serve to sharpen your understanding of what the algorithm is really doing. Couple that fact with the self-check questions, exercises with solutions, and associated video lectures, and what we have here is a wonderful resource for the motivated algorithms learner.


By Robert Sedgewick, Kevin Wayne,

Book cover of Algorithms

Why this book?

Many of my favourite algorithms books give short shrift to designing APIs for the algorithms and data structures that they present. The Sedgewick and Wayne book, by contrast, goes all in on an object-oriented API design. This is my book choice for Java programmers and those interested in larger program design considerations. Clear your calendar: each chapter here is massive, but I think the time investment is worth it. I especially like the chapter that shows how to tune classic algorithms for realizing speedups when working with strings.

Data Structures and Algorithms

By Alfred Aho, Jeffrey Ullman, John Hopcroft

Book cover of Data Structures and Algorithms

Why this book?

This is the book that started it all for me… and I think it holds up just fine today. I see value in confronting the old Pascal code every so often: it’s a reminder of how little we need in order to make our algorithms fast, and how much is happening behind the scenes by our modern programming languages. To this day this book has some of my favourite presentations of Dijkstra’s Algorithm and sorting.

A Common-Sense Guide to Data Structures and Algorithms: Level Up Your Core Programming Skills

By Jay Wengrow,

Book cover of A Common-Sense Guide to Data Structures and Algorithms: Level Up Your Core Programming Skills

Why this book?

For an overview book that focuses on intuition—a book that is intentionally designed to evade formality—to make my list, it has to be really, really good. This one is. I appreciate the inclusion of real code in multiple programming languages and the step-by-step traces of algorithms. I appreciate the care taken with the Big O material and the way that abstract data types are introduced. This is one of very few books whose recursion material I like—the ‘napkin’ approach to recursion is wonderfully done.  

1 book lists we think you will like!

Interested in algorithms, computer science, and computer programming?

5,887 authors have recommended their favorite books and what they love about them. Browse their picks for the best books about algorithms, computer science, and computer programming.

Algorithms Explore 18 books about algorithms
Computer Science Explore 19 books about computer science
Computer Programming Explore 23 books about computer programming

And, 3 books we think you will enjoy!

We think you will like The Golden Ticket, Introduction to Algorithms, and The Art of Computer Programming if you like this list.