<, a place where we can talk about coding, as well as some other stuff too./>

A Coding Blog Written By Matt Zhou
Posted by Matt Zhou on 2019-02-06

Traps you need to avoid when doing algorithms when learning to code. (For Beginners)

These are some of my own experience when it comes to working with algorithms (in javascript), including mistakes I have made in the past. This guide is not for everyone, if you have been coding for years I think algorithms should be a lot easier for you. But if you are a beginner like me, you might find of the obstacles we face are quite common.

1. Set a "fixed" target when it comes to how many algorithms you want to do per day/week/months.


"you know what, I am gonna solve 5 algorithms each day, and if I don't finish them I won't go to sleep".


Different algorithms takes different time to solve. There are complex algorithms and there are entry level ones. There are algorithms that you can solve using javascript's built in functions, and there are algos that you have to build from ground up. Do not expect if it takes you one hour solve A, then later when you meet B it will take you one hour too. Sometimes it takes little to no time to solve an algorithm, sometimes it may take you days or weeks to figure something out.

2. Doing all the algorithm challenges all at once.


"Next week I am gonna start applying for jobs, so right now I want to do all of the algorithms on freeCodeCamp so that I will be prepared"


From my personal experience, this is not the best way to do algorithms challenges. It adds an extra layer of stress on you. Algorithms solving itself is not an easy task. Especially if you are a beginner who just got into (insert the language you are learning). The best way to do algorithms is to do it gradually, make it part of your daily learning routine. (But not all.) I wrote an article that mentioned how to divide your time when it comes to learning to program. Personally I find it to be stressful, and there are times where I got burnt out by doing algos on freeCodeCamp hence I have to take a break from programming all together. I think many of us had this experience.

3. Feeling that only smart people can do this.


"If I find this too hard, then programming is not for me, real programmers probably won't even slower the speed of their typing when doing algos"


Programming is a skill you can master through practice. The statement above is the equivalent of something like: "Pianists are born pianists." Al Pacino once said: "Repetition keeps me green." Through practice you are gonna get better at thinking like a programmer. I remember it took me a week to understand the concept that it is good practice to set up an empty variable (might it be an array or string) then slowly add in all the element to it then output the result at the end of the function.

4. Not being flexible enough to switch between doing algorithms and other tasks.


"No matter how difficult it is, I'll have to finish all the algo challenges within these few months. It's algo time baby!"


There are days that you can be so tired after spending a lot of energy doing your job, that you simply cannot sit there and concentrate on coding. There are many times where I can watch some videos about coding, or I can do a HTML CSS mock up, but not doing algorithms. My energy level is low, and I couldn't concentrate 100%.

Be flexible enough to switch between the tasks that you have on your hand. Dylan Israel once said: "If I got burnt out doing algorithms, I'll do some of my side projects. If I got tired from my side projects, I'll start a new side project. " The reality is, learning to be flexible enough to switch between tasks can only benefit yourself in the long term. It will make the mundane part of programming seems not so mundane. It will boost your productivity and keeps yourself fresh.

5. Learn how to be as relaxed as possible when doing algorithms.

The last one was mostly my own experience. I got nervous whenever I am doing algorithms. The thought that maybe one day someone will interview me for it always makes me nervous. And I know, if I am being more relaxed, I can solve algorithms better and faster. I think it takes time and practice to reach the state of "relaxed yet concentrated". This is something I need to work on next.

If you want to protect your online privacy and give VPN a try, consider using my affiliate link where you and I both can get one month of super fast VPN free of charge. 🤗 🤓

Or if you are trying to find a place to host your project, give Digital Ocean a try. link You will be getting $100 of credit, the only thing you need to do is to use it within 60 days.

Go Back