Four ways to master algorithm in less time

·

3 min read

Algorithms are one of the most powerful aspects of a computer science education. It is a great place to train your problem-solving abilities. Abilities you can carry in every other area of technical study.

There are countless resources for learning algorithms. You can get lost figuring out where to start. This article is a list that can help you master algorithm better and faster.

Read a book and watch the course

There are a lot of algorithm books out there. And they are great. But I am looking for something practical. So I choose to follow the recommendation by teachyourselfcs.

Algo book

Algorithm design manual. This book is super practical. Half of the book talks about algorithms design. And the other is a catalog of algorithmic problems. You should read the first half. The second half you can use as a reference when you bumped into problems that you do not know how to answer.

Additionally, the Algorithm Design Manual author has kindly published the lectures videos on his website. The videos are fantastic resources that will help you in your journey to master this topic.

Practice subtopic in HackerRank or LeetCode

Reading and watching video lectures are great, but you need to practice. These days you can practice your skill on many sites. HackerRank and LeetCode are both excellent resources. You can't go wrong with either one. Whenever you finish a topic like the Heap or Queue, go to either of these sites and find problems utilizing these data structures and practice to solve those problems. You don't need to solve them all; three to five problems are enough.

Build a good problem-solving habit

When you try to solve any problem, the tendency is to go to the implementation immediately. This tendency is not a good habit. This habit leads to mistakes and wrong assumptions. But a lot of programmers do this all the time, including me.

To build a good habit, you can use the Algorithm Design Canvas. The HiredInTech team makes this canvas.

Algorithm design canvas

You might think using the canvas to solve a problem is bothersome. But once you get into the habit of using this, you won't feel that this takes too much time. When you try to solve a problem, you will immediately seek clarification about the problem constraints. You will consider at least two ideas instead of sticking with the one solution you can think of at the moment. Once you have ideas, you then choose which one you want to implement. You make sure your implementation works by providing tests. If you like a test-driven approach, you can provide test cases before you start implementing the solution.

Learn about common patterns in programming problems

One knowledge that will help you progress tremendously is to see common patterns in programming problems. By recognizing these patterns, you will improve the ability to map a new unsolved problem to an already known problem.

The best resource for this that I found is the educative.io grokking interview code course. You can find the course on the educative.io website.

Grokking coding interview

The course has around 16 patterns and 150+ problems. The course is an excellent resource for your quest to master algorithms. The explanations are brief yet clear, and there are plenty of problems to work through. The problems also come with difficulty indicators.

Summary

One book, two courses, build a good problem-solving habit, and places to practice coding. This article is a minimalistic list to help you master this topic. But this should get your programming ability to the next level.