# What is Algorithm And Why is It Important?

When you’re learning programming, you’ll inevitably stumble upon algorithm. But, what is it and why is it so important?

Algorithm is a set of procedure to accomplish a task. It gives step-by-step instructions to do something. For example, to sort numbers, you find the smallest number, put it in the first position, find the second smallest number and so on. But, of course this example is so generic as there are many specific methods to sort a set of numbers.

In programming, you use algorithms for everything. Well, your computers are basically built with algorithm after all. You write a specific set of instructions or algorithm and your computer will run it for you.

Algorithm takes specific input and gives back desired output. You want to sort numbers in JavaScript? You make a function with your sorting algorithm in it, input your parameter, get your sorted numbers as the result.

If possible, algorithm has to be correct, efficient and easy to implement. But that would be pretty hard. So as long as it is correct and not to slow, the algorithm should be alright.

## Prerequisite

Although everybody can learn algorithms, you should at least know a programming language to run the algorithm. It’s obvious since you’re learning algorithms for programming. Most universities has this subject anyway.

## Why Is Algorithm Important?

Can you program or develop an application without being good at algorithm? You definitely can! So, why do we still need to learn it. Aside from the fact that it is used for coding interviews of course.

In large scale applications where a lot of processes run, you’d want the algorithms to be fast. Imagine having a slow algorithm in a complex application, it would slow down greatly.

Getting used to algorithm also improves your problem solving skill. It teaches you to think systematically, define the problem clearly and make the appropriate solution for it. It’ll surely help when you want to implement a feature to your application. You have a set of tools (your programming language of choice and its features) and you have to figure out how to use them to solve your problem.

So, it all comes down to getting used to solve problems with the most efficient speed.

## How to Learn?

The best way to learn something for me personally is a mixture of knowledge and practice.

So, if you feel the same way as I do, I would recommend you pick up whatever one learning material is best for you (it could be a book or a YouTube tutorial or even a course), learn and reference from it, then practice a lot on HackerRank or similar platforms.

You could also learn from my blog, I would be posting a series of posts discussing DSA (Data Structures and Algorithms) with codes in JavaScript since that’s what I’m most comfortable with.

## What Language Should You Use?

A lot of people recommend using C or Java for DSA, but you should use whatever you are most comfortable with or whatever you are using a lot. I you are aiming to be a Python developer, then use Python. Simple as that!

## Summary

So that’s it! Algorithm is a set of procedure or instructions to complete a task.

Check out my blog to learn more about Web Development or Algorithms! For relevant informations to this post, I recommend reading Data Structures In JavaScript and How To Measure Algorithm Complexity.