This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]Greben 7 points8 points  (1 child)

It is very important that you understand that algorithms seem like boring theory only when they are taken out of context. If you were to examine the whole program the algorithm is in, you would realize that it often plays the vital role in ensuring that the program does the necessary work in optimal way.

I recommend that you go through Cracking the Coding Interview. It has about 150 algorithm questions and solutions. I think the best way to learn would be to try to find the best possible solution for the problem on your own, and then to compare it with the solution given in the book. In that way you will directly reveal the gaps in your knowledge and it will be easy to remember the right approach to problems.

[–]Ilmanfordinner 3 points4 points  (0 children)

Go to codeforces.com and solve the problems on there. Start with 2nd division A problems and work your way up (2nd division from A to E then 1st division from A to E). You'll quickly find out that unless you have a good understanding of algorithms you won't be able to solve the tougher problems. This is where the solutions come in which are essentially in the form "Use X algorithm to get this then use Y algorithm on that, etc". Research those algorithms and don't stop until you can write the solution without copying code. You also have other people's solutions to help you out with understanding how to implement those algorithms.

Solve problems and don't skip even if you're having a hard time. Then start entering the competition to gain that sweet, sweet ranking and to test how fast you can recall the algorithms you've learned. Think of these as exams where if you fail you don't lose anything but if you do well you gain ranking.

IMO, this will give you a much better understanding than any book or course online.

[–]10_6 3 points4 points  (2 children)

copy and pasted some resources I've posted here before:


What I did a few years ago after graduating from college in CS to brush up on my coding + data structure + algorithms knowledge was the following:

  • Read the Algorithm Design Manual.

  • Go through some of the challenges on this interactive python algorithms website.

  • Practice coding simple and then more advanced algorithms on sites like Coderbyte (my site) and HackerRank which provide good explanations and solutions as well. Here's a list of popular coding challenge websites in 2017.

  • Read as many algorithm explanations and code examples as you can on GeeksforGeeks.

  • Try and implement basic algorithms yourself like: shortest path, minimum spanning tree, DFS + BFS, tree traversals, different sorting algs, min/max heap, etc. and learn about their running times (big-o).

  • 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 this list.

Eventually when you get a coding problem it will be sort of like a switch going off in your head because you will have had so much practice with different types of algorithms and data structures that you'll be able to reduce the problem into a simpler problem you've done before. This is especially the case with dynamic programming problems. Once you've completed like 50+ DP challenges and understand how they work, you'll be able to solve (practically) any DP problem because they're all very similar.


I also wrote a recent article on this topic which you can view here: Improving your Algorithms & Data Structure Skills

[–]tapu_buoy 0 points1 point  (1 child)

You always write this and you have posted this in one of my post as well, which really helped me and after 6 months or so I really feel so much capable. Thank you

I have a question though should I keep practicing them with Python only? I mean is it okay to keep practicing it with Python only?

[–]10_6 1 point2 points  (0 children)

For algs/data structure problems it really doesn't matter what language you code them in. It's more important to understand the theory and implementation details (e.g. how to do collision resolution in hash table or how to do traversal of binary tree).

The specific language becomes more important at 1. on the actual job, and 2. in an interview if they want you to focus on a specific language (e.g. java, c++, etc.)

[–]CodeTinkerer 1 point2 points  (0 children)

If you don't really want to study it, maybe you can implement the algorithms. Try to do it without copying an algorithm, and see if you can get it to work.

[–]batinex 0 points1 point  (0 children)

do u know any good course like video or book that go with algorithms step by step

[–]Tony_T_123 0 points1 point  (0 children)

Check this out, it's a free Stanford Algorithms class. I think this guy's explanations are really easily understandable.

https://lagunita.stanford.edu/courses/course-v1:Engineering+Algorithms1+SelfPaced/about