How to develop algorithmic thinking

I've been asked by many of my peers that even though they are good at general coding, they just can't seem to develop algorithmic thinking process. We discuss how to improve your problem solving skills in programming.

All of us are running algorithms all day long. We just don't think of it like that.

Getting dressed is an algorithm, making tea is an algorithm, finding shortest path to a building is an algorithm - it's all just processes.

The skill is in being able to translate a process into code and that comes from being able to articulate the process in some way.

Find a problem - work out all the steps to solve that problem (literally just: Get trousers out of drawer, put left leg in, etc...). If you see any steps you can skip out or optimise (I keep my clothes out on chair the night before) then do that. Follow your own instructions.. are you dressed? Then you have a successful algorithm!

Now how to do that with code?

  1. Break the problem down into small steps in pseudo code
  2. Implement it in actual code.

Algorithmic thinking takes practice.

You can't really develop thinking a certain way quick enough or independently unless you teach yourself to think that way. One way to teach yourself to think that way is by watching others think a certain way or reading other people's approach to solving problem which is basically the thought process behind solving those problems.

The next step would be to test yourself by solving problems that are incrementally difficult to solve. Don't start with the toughest problem. Each time pay attention to how you think. You'll be surprised that with every new problem you solve, your brain is able to think a little faster next time, especially if it's a similar problem. Eventually, you'll reach a point where you are questioning existing solutions and coming up with more efficient ones.

This is what I would consider algorithmic thinking and you don't get it unless you do it. The best part is that anyone can acquire this magical thinking ability with enough practice.

Here are few resources where you can find problems to practice algorithmic thinking:

  1. Project Euler: Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve.
  2. CodeWars: Codewars is a community of developers, who are called Code Warriors (or just warriors), that train on improving their development skills. Think of it like a coding school - where developers train with each other and help each other get better through practice.
  3. Leetcode: It has over 1400 questions for practice. It is one of the largest tech communities with hundreds of thousands of active users.

You can provide feedback to this post by writing an email to : talkingdevblog+algo@gmail.com

...