# Improving your Algorithms & Data Structure Skills

![](https://cdn-images-1.medium.com/max/2000/1*kiUNXcnWEYg7wRI9qeFX_A.png)

Image from [Dynamo Primer](http://dynamobim.org/more-primer/).

*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* [*original*](https://www.reddit.com/r/learnprogramming/comments/6ytb4r/what_would_be_a_fun_and_brain_friendly_way_to/)*thread, and my new write-up is below.*

#### Fundamentals <a href="#id-80b8" id="id-80b8"></a>

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 bootcamps](https://www.hackreactor.com/blog/software-development-school-program-specifics-hiring-outcomes-housing-and-more) focus a bit on the topics below, or you can learn on your own from [books](https://www.quora.com/What-are-the-best-books-to-learn-algorithms-and-data-structures-Are-there-any-good-blogs-posts-on-these-Which-books-explain-these-concepts-in-a-simpler-way), videos, or [online](https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/) 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 <a href="#d25a" id="d25a"></a>

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.

![](https://cdn-images-1.medium.com/max/400/1*XKoqMjik1mSgMxJ5yqDG9A.png)

![](https://cdn-images-1.medium.com/max/400/1*BkjTLrm1gW-hjpHRRd_liA.png)

![](https://cdn-images-1.medium.com/max/400/1*EPpGdixnWQlsZUWI5n65bA.png)

Pages taken from [The Algorithm Design Manual](https://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena/dp/1849967202).

**Big-O & Runtime**

* Learn what [Big-O](https://en.wikipedia.org/wiki/Big_O_notation) is and how to analyze the [running times](https://cs.stackexchange.com/questions/192/how-to-come-up-with-the-runtime-of-algorithms) of algorithms. This is a [classic book](https://en.wikipedia.org/wiki/Introduction_to_Algorithms) on the topic (here is the chapter on the [growth of functions](http://www.cs.dartmouth.edu/~ac/Teach/CS19-Winter06/SlidesAndNotes/CLRS-3.1.pdf)).
* Here is a good [list of online courses](https://github.com/tayllan/awesome-algorithms#online-courses) that teach algorithms.

**Implement Some Algorithms Yourself**

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

* Binary search
* Euclid’s algorithm
* Depth and breadth first search
* Dijkstra’s shortest path
* Binary tree traversals
* Insertion sort, Mergesort, Quicksort
* Min & max heaps
* [More](https://www.quora.com/Which-are-the-10-algorithms-every-computer-science-student-must-implement-at-least-once-in-life) [examples](https://hbfs.wordpress.com/2008/12/23/the-10-classes-of-algorithms-every-programmer-must-know-about/) and [lists](https://softwareengineering.stackexchange.com/questions/155639/which-algorithms-data-structures-should-i-recognize-and-know-by-name).

**Algorithm Books**

* Read the [Algorithm Design Manual](https://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena/dp/1849967202). It’s a great book and it’s my favorite.
* [Introduction to Algorithms](https://en.wikipedia.org/wiki/Introduction_to_Algorithms) is a classic book that covers a lot of material.
* [Elements of Programming Interviews](https://www.amazon.com/Elements-Programming-Interviews-Insiders-Guide/dp/1479274836) contains a lot of challenges and code solutions that will help you prepare for interviews.

**Challenges**

* Practice coding simple and then more advanced algorithms on sites like [Coderbyte](https://www.coderbyte.com/) and [HackerRank](https://www.hackerrank.com/) which provide explanations and solutions so you can learn from other coders as well.
* Go through the challenges on this [interactive python algorithms website](http://interactivepython.org/runestone/static/pythonds/index.html).
* [The 10 most popular coding challenge websites for 2017](https://medium.freecodecamp.org/the-10-most-popular-coding-challenge-websites-of-2016-fb8a5672d22f).
* [The 5 hardest code challenges for beginners](https://medium.com/coderbyte/the-5-hardest-code-challenges-for-beginners-e410da4474b).

**Algorithms Explanations & Interview Questions**

* Read as many algorithm explanations and code examples as you can on [GeeksforGeeks](http://www.geeksforgeeks.org/). Here is an [example](http://www.geeksforgeeks.org/graph-data-structure-and-algorithms/) of a good post on graph algorithms.
* Look at some interview questions posted on [CareerCup](https://www.careercup.com/) and try and understand how other users solved the questions. Like [this example](https://www.careercup.com/question?id=5641027330244608).
* Aside from coding challenge sites, try and solve common coding interview questions you find online [such as the ones on this list](https://techiedelight.quora.com/500-Data-Structures-and-Algorithms-practice-problems-and-their-solutions?srid=dV6r).

**Dynamic Programming**

This a *very* [important concept](https://en.wikipedia.org/wiki/Dynamic_programming) 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 [LeetCode](https://leetcode.com/problems/longest-palindromic-subsequence/description/), [Google Code Jam](https://code.google.com/codejam/contest/10224486/dashboard), and several challenges on [Google Foo Bar](http://www.geeksforgeeks.org/google-foo-bar-challenge/) required a DP solution.

I’d recommend to try and solve as many [problems on this list](http://www.geeksforgeeks.org/dynamic-programming/) as you can. There is also a good tutorial on TopCoder titled: [Dynamic Programming — From Novice to Advanced](https://community.topcoder.com/tc?module=Static\&d1=features\&d2=040104). 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)**

* [Advanced Data Structures](http://courses.csail.mit.edu/6.851/fall17/lectures/) Lectures by [Erik Demaine](http://erikdemaine.org/)
* [Algorithmic Lower Bounds: Fun with Hardness Proofs](http://courses.csail.mit.edu/6.890/fall14/lectures/) by Erik Demaine
* [Competitive Programmer’s Handbook](https://cses.fi/book.html)
* [The Hitchhiker’s Guide to the Programming Contests](http://comscigate.com/Books/contests/icpc.pdf)
* [AlgoWiki](https://github.com/AlgoWiki/AlgoWiki): A wiki dedicated to competitive programming
* [Computational Geometry](https://en.wikipedia.org/wiki/Computational_geometry) problems and algorithms ([cool](https://en.wikipedia.org/wiki/Voronoi_diagram) and [fun](https://en.wikipedia.org/wiki/Delaunay_triangulation), but can get quite difficult)
* [List of NP-complete problems](https://en.wikipedia.org/wiki/List_of_NP-complete_problems)
* [Open Data Structures Book](http://opendatastructures.org/): implementation and analysis of data structures for sequences, queues, priority queues, unordered dictionaries, ordered dictionaries, and graphs

I hope you enjoyed this list of resources. Feel free to practice coding on [Coderbyte](https://www.coderbyte.com/), and comment below with any other resources you think are helpful.<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stephanosterburg.gitbook.io/scrapbook/math/improving-your-algorithms-and-data-structure-skills.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
