Algorithms, with a healthy dose of excitement

With this lesson, we begin our journey into algorithms.

alt minion-applause

Pause for applause and smiles.

So what is an algorithm? The word algorithm is just a fancy word for procedure. Skeptical that it's that simple? Let's see what the great oracle Wikipedia tells us.

alt algorithm

Like we said, a procedure. Yes, it's vague. Yes, you have been coding procedures since you've started this course. When we explore algorithms, we'll consider procedures that have already been implemented in many languages. For example, both Ruby and Javascript have a sort method and a find method. In our discussion, we'll learn how they work.

Why learn algorithms

With the knowledge that these algorithms have already been solved and implemented by others, we can now accord them the proper spot in our coding brain. We find them very important to understand as they are tools all languages (and therefore, us as programmers) lean on. In addition, the problems they solve are generic enough that we can draw parallels to them when coding day to day, and therefore can lean on the shoulders of giants when solving a similar problem.

So we learn algorithms because (1) our programming languages lean on them, and we therefore rely on them and (2) because if we find a problem that has already been solved by an algorithm, we can evaluate that algorithm's technique, and when appropriate, apply it.

The danger of learning algorithms is that they often ask us to consider how long a procedure takes, and this consideration can sometimes become a misplaced priority. When coding, we should still have our priorities as follows:

  • Make it work
  • Make it right (i.e., readable)
  • Make it fast

And with that disclaimer out of the way, let's make it fast.

alt speed

View Why Algorithms on Learn.co and start learning to code for free.