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 focus a bit on the topics below, or you can learn on your own from books, videos, or online lectures. So you’ll need a basic understanding of the following topics to get started:
Learn about arrays, linked lists, binary trees, hash tables, graphs, stacks, queues, heaps, and other fundamental data structures.
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.
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.
Here is a good list of online courses that teach algorithms.
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 examples and lists.
- Read the Algorithm Design Manual. It’s a great book and it’s my favorite.
- Introduction to Algorithms is a classic book that covers a lot of material.
- Elements of Programming Interviews contains a lot of challenges and code solutions that will help you prepare for interviews.
- Practice coding simple and then more advanced algorithms on sites like Coderbyte which provide explanations and solutions so you can learn from other coders as well.
- Go through the challenges on this interactive python algorithms website.
- The 10 most popular coding challenge websites for 2018.
- The 5 hardest code challenges for beginners.
- Read as many algorithm explanations and code examples as you can on GeeksforGeeks. Here is an example of a good post on graph algorithms.
- Look at some interview questions posted on CareerCup and try and understand how other users solved the questions. Like this example.
- Aside from coding challenge sites, try and solve common coding interview questions you find online such as the ones on this list.
This a very important concept 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:
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, Google Code Jam, and several challenges on Google Foo Bar required a DP solution.
I’d recommend to try and solve as many problems on this list as you can. There is also a good tutorial on TopCoder titled: Dynamic Programming — From Novice to Advanced. 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 Data Structures Lectures by Erik Demaine
- Algorithmic Lower Bounds: Fun with Hardness Proofs by Erik Demaine
- Competitive Programmer’s Handbook
- The Hitchhiker’s Guide to the Programming Contests
- AlgoWiki: A wiki dedicated to competitive programming
- Open Data Structures Book: 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, and comment below with any other resources you think are helpful.
This article originally appeared on Medium.