How to write/construct algorithms

Is anyone out here having a hard time to write algorithms to solve problems in JS curriculum and wanna learn how to develop the ability to construct algorithms?

Pretty much everyone. No one tries algorithms and finds it easy. Some might skate through the first level (if they have a puzzle oriented mind, or whatever) but everyone reaches a point where the struggle.

How do you get better? Well, doing a lot helps. Every algorithm you master is a tool in your tool box. Once you solve one, look and see how others solved it. You can look online and find people explaining how to solve them, in blogs of videos. Don’t do it on one that you are trying to solve, but after you’ve solved it, that can be great.

Learn to think outside the language. Learn to write pseudo code. Learn to think of the problem in a physical form, like if you were working on a sort algorithm, try thinking of having a bunch of note cards in front of you with numbers on it. How would you tell a robot (with no intuition) the procedure for sorting?

And it just takes time. Don’t worry if they don’t come right away. Just keep at it.

Thank you for the advice and I appreciate it. :blush:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.