Improving your Algorithms & Data Structure Skills

Image from Dynamo Primerarrow-up-right.

Some of the resources in this article originally appeared in one of my comments on a reddit post that became quite popular. Here’s the originalarrow-up-rightthread, and my new write-up is below.

Fundamentals

The first thing you’ll need if you want to get better at algorithms and data structures is a solid base. This base can be learned one of several ways, either through a computer science program at university, some coding bootcampsarrow-up-right focus a bit on the topics below, or you can learn on your own from booksarrow-up-right, videos, or onlinearrow-up-right lectures. So you’ll need a basic understanding of the following topics to get started:

Data Structures

Learn about arrays, linked lists, binary trees, hash tables, graphs, stacks, queues, heaps, and other fundamental data structures.

Math & Logic

You’ll need to know some mathematical concepts from several different areas if you want to excel at algorithms. Learn about set theory, finite-state machines, regular expressions, matrix multiplication, bitwise operations, solving linear equations, important combinatorics concepts such as permutations, combinations, pigeonhole principle.

Computer Architecture

Learn how data is represented in a computer, the basics of digital logic design, boolean algebra, computer arithmetic, floating-point representation, cache design. Try and learn a little about C and Assembly programming.

Moving Forward Past the Fundamentals

Once you feel like you have a good understanding of most of the concepts listed above, it’s time to start diving into the algorithms part. Here is a list of resources and things I did to get better at writing and understanding important algorithms.

Pages taken from The Algorithm Design Manualarrow-up-right.

Big-O & Runtime

Implement Some Algorithms Yourself

Start off by implementing several important algorithms yourself and learning about their running times. Some examples are:

Algorithm Books

Challenges

Algorithms Explanations & Interview Questions

Dynamic Programming

This a very important conceptarrow-up-right you will need to understand if you want to get better at algorithms, which is the reason I separated this topic from the rest. The description from Wikipedia for it is (bolding is mine):

A method for solving a complex problem by breaking it down into a collection of simpler subproblems, solving each of those subproblems just once, and storing their solutions. The next time the same subproblem occurs, instead of recomputing its solution, one simply looks up the previously computed solution, thereby saving computation time.

I have seen dynamic programming show up in several coding interviews I’ve had. I’ve also seen problems that require a dynamic programming solution on challenge sites like LeetCodearrow-up-right, Google Code Jamarrow-up-right, and several challenges on Google Foo Bararrow-up-right required a DP solution.

I’d recommend to try and solve as many problems on this listarrow-up-right as you can. There is also a good tutorial on TopCoder titled: Dynamic Programming — From Novice to Advancedarrow-up-right. A lot of DP problems have the same structure and patterns so if you solve 3 DP problems everyday for 2 weeks or so, after a while you’ll be able to spot and solve a DP problem no problem.

Advanced Resources in Algorithms (optional)

I hope you enjoyed this list of resources. Feel free to practice coding on Coderbytearrow-up-right, and comment below with any other resources you think are helpful.

Last updated