# A Self-Study Routine to Mastering Algorithms

Algorithms are the key to any technical job, including programming and data science. Most companies test for ability to craft good algorithms more than anything else while recruiting. This is for a reason — computing languages are very easy to learn, ability to write algorithms is not.

I have learnt the hard way that algorithms is an acquired skill, like riding a bicycle, that you can learn only by practice. While nothing can beat a good teacher, try these steps to master your prowess at algorithms.

- Pick any computational problem that you fancy. Any simple ones from grade 10 math book will do. Lets say generating prime numbers less than N.
- Solve it the best you can. You don’t really need to know much about algorithms at this stage. Think about the simple math behind things and solve the problem.
- Then think about if this is the most efficient algo. Can this be done in a better way? How would you measure that?
- Now the fun starts. Look at the complexity of your solution. If lets say N = 100, how many steps will your program have to make. Lets call that t. Now how does that change when N = 1,000? Can that be reduced? Can you get to an algo where t is linearly dependent on N? Better than that?
- Next, think about how much storage your program is taking. Do you have to store long list of numbers? Can that be avoided? What is the trade-off between complexity and storage. Now you are talking real algos like professionals.
- Finally, how robust is your algo. If something breaks, how easy is it to recover. Surprisingly, many many software engineers doing this day in day out miss this point.
- Now think about how much time did it take you to go through these six steps. What is the intuition that would have let you come up with the best answers in the first attempt? Time to try the next problem, right from step 1.

Sure there are books and stuff that give you some good ideas. So would stack overflow. Just pick the problem and get started!