What’s the best way to learn algorithms for programmers?

Once I was asked this question on Quora. My answer got 17.7k Views and many upvotes. The person who asked the question needed some specific learning path & resources. When I was used to do competitive programming and learn algorithms, I followed some steps to learn algorithms. Those steps were best fit for me. May be those steps can be helpful for you also. So, here I am sharing my learning steps -

Reading a book is very essential because every topic is described in detail into a book, but in videos/tutorials everything is described in short.

For books I will recommend — 
1: Introduction to Algorithms: Charles E. Leiserson, Clifford Stein, Ronald Rivest, and Thomas H. Cormen
2: Algorithms (4th Edition): Robert Sedgewick, Kevin Wayne
3: The Algorithm Design Manual: Steven Skiena

Some online resources:
Data Science Tutorials
Algorithms — GeeksforGeeks

Resources to practice:
1: http://lightoj.com/volume_problemcategory.php
2: World of Seven — Methods to Solve
3: A2 Online Judge
4: HackerRank
5: CodeForces

Now come to the steps:
I follow “Learning by doing” philosophy.

Step 1: At first you should learn the theory of any particular algorithm from your books/resources.

Step 2: Try to implement the algorithm(theory) you’ve learnt into code without looking at others implementation. After much trying if you can’t implement then take help of others.

Step 3: Now pick up a link from Resources to practice and solve some problems related to the algorithm you’ve learned recently.

To me this my best way to learn algorithms.

Best of luck. :)

This article was also posted in my personal blog.