Your programming roadmap

Algorithms

Big O notation, binary search, divide and conquer, depth-first search, breadth-first search, dynamic programming, greedy algorithms

Use algorithms to solve problems efficiently and effectively.

Consider using the apply first, study second approach with the resources below: try a problem or exercise from the Apply It section first. If you get stuck, then use a course, book, or lecture in the Reference section. Or if you’re completely new to a topic, then learn just enough and apply right away. The point is: the quicker you get to the “doing,” the better the learning. Make your learning active.

Apply It

I’ve cycled through many resources to learn algorithms, and AlgoExpert is the best by far. If you really want to learn—and understand—algorithms, then this comprehensive problem-solving platform is for you.

I mention AlgoExpert in several other spots throughout the Pyramid, but right here in the Algorithms section is where it really shines. You’ll find hints and tests for each problem, as well as the ability to group problems in different ways (e.g., by category or level of difficulty).

"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

-René Descartes

But there’s more. In fact, there are two aspects of AlgoExpert that stand out to me. First, each problem has a video explanation that consists of two-parts: a conceptual overview and code walk through, where you’ll get a line by line explanation of AlgoExpert’s provided solution(s).

Watch the entire video once you’ve solved the problem. Yes, it’s important to understand the solution. But it’s equally important to understand the concepts behind it. Instead of big leaps, you’ll find clear and thoughtful explanations. Plus, you’ll open your eyes to new (and better) ways of doing things.

Tip: Since we’re in the Apply It section, I’m going to share my recipe for how I turn this passive activity of watching a lecture into an active one to retain the information gained. It derives from a learning technique that Ben Franklin used to become a better writer, where he tried to reproduce an article from a publication he admired—after he’d forgotten the details of it.

I’ve modified Franklin’s approach and apply it to the programming problems I solve. It’s a great way to solidify your learning and reinforce concepts.

Solve a problem on AlgoExpert, then follow this process:

  • Study the written solutions provided. Each problem comes with one or more written solutions. For each solution, read each line of code and type a comment in a new file in your text editor to summarize it. This practice will help you get better at reading code, and get you thinking through the logic behind the code before the video distills the details.
  • Watch the provided video. Make notes in your file to add or update the short summaries you’ve already drafted.
  • Let some time pass, and then re-solve the program. Use the comments you typed out as hints to guide you along the way.
  • Compare your new solution to the one you studied.

You can apply this technique to any problem that you study. But this practice is particularly useful for learning algorithms.

Then, test your assumptions. AlgoExpert is a great resource for this, too, and is the second point to highlight. It not only provides the time and space complexity for each solution provided. But the video lectures for each problem also provide the rationale behind them. This context is critical. Instead of memorizing, you’ll find yourself really understanding this important concept.

I’ve found it beneficial to work through problems on AlgoExpert in conjunction with Advent of Code and LeetCode. The idea is to take what you learn and do on AlgoExpert and apply it to other problems. This is a great way to exercise what you’ve been learning, and to find the roadblocks.

Advent of Code is free and the problem selection is quite good; they’re also fun. Another benefit is its popularity. A lot of great programmers participate in Advent of Code each year, which means there are a lot of great solutions to study. So after you complete a problem, study the solutions of others who’ve solved the same problem. Use the same approach discussed in the above tip.

As you think about your algorithm practice, consider this cadence: work through a few problems on AlgoExerpt (and their solutions). Then, complete a problem or two on Advent of Code or LeetCode, which is one more resource to consider for algorithm practice. Sign up for an account, then filter the problems by topic, like “Dynamic Programming” or “Greedy.” Many problems are free on LeetCode, and you can often find useful learnings in the “Discuss” tab where people share their solutions.

Tip: AlgoExpert encourages you to solve each problem multiple ways: each problem has three “solution” tabs for your different solutions. I encourage you to do this. Solving the same problem with different approaches is a great way to exercise your programming creativity, get outside of your comfort zone, and to think critically about time and space complexity tradeoffs among your different solutions.

Reference

Ease yourself into algorithms with Aditya Bhargava’s book, Grokking Algorithms. It’s a resource I mention throughout the Pyramid, and it’s useful here because it covers algorithms in a fun and useful way: with lots of pictures. The many visuals make complex algorithms and related concepts easier to think about (and remember). This is a good resource to start with if you’re newer to algorithms: learn the big concepts before diving into the weeds.

Tip: Algorithms are hard. They’re hard for everyone. So take it slow through this section of the Pyramid. Taking the time to come up with multiple solutions, identifying the time and space complexity, studying solutions of others, and really nailing the concepts now at the outset will pay dividends down the road.

AlgoExpert is as much of a problem-solving platform as it is a reference. Here’s what I mean:

Use The Algorithm Design Manual by Steven Skiena to take a deeper, more nuanced dive into algorithms. You can also freely access Skiena’s video lectures that are based on his book.


← Back to Programmer's Pyramid