Why is it Important to Understand Algorithms?
This guide explains why it's important to understand algorithms, including a discussion on: speed, accuracy, and overall growth as a developer.
Guide Tasks
  • Read Tutorial

So, now that you know what an algorithm is, let's discuss why it's important to understand algorithms. I'm not sure what your background is, but I taught myself how to be a developer before I learned formal algorithms in school. When I went through my first algorithm course at school my initial reaction was:

Why in the world do I need to know this?

The main reason for my reaction was due to a few factors:

  1. The algorithms that were covered in class were features that had already been built into all of the languages that I worked with. For example, we spent weeks learning about how to build various sorting algorithms. However all that was going through my mind was: I can just call the sort() method and do this in a single line of code....

  2. There didn't seem to be a practical goal to understanding how algorithms work. The focus was simply on studying the processes, which didn't work well with the way that my mind learns. I like to know why a topic is important and more importantly how I can use it in a real world application. Everything in class was theoretical, which didn't click with me initially.

It was actually going through that algorithm class that inspired me to build this course that walks through how to understand algorithms from a developer perspective. I'll also come back to my two reactions to discuss why I was wrong on both counts.

Let's discuss the three reasons why it's important to learn algorithms. This list is by no means exhaustive, however it entails the key reasons why I believe that all developers should learn about algorithms.

Performance

large

Going fast is fun, whether it's on the open road or with your application. The study of algorithms spends a considerable amount of time focusing on how to increase program performance.

There can be a shocking difference in the performance of very similar goals. For example, if you use the Bubble Sort algorithm on a collection of 300k integers it will take over 9 minutes. However if you use the Quicksort algorithm it will sort the same collection of 300k integers in less than a second.

large

Hopefully that illustrates how important choosing the right algorithm is in regard to performance. As you go through the course you'll discover that algorithm performance is discussed in each module, including a discussion on how to analyze algorithms for yourself.

Accuracy

large

No matter how fast an algorithm is, if it's not accurate it doesn't hold much value. Imagine that if the Google Maps algorithm could generate an incredibly quick route but it took you around the country in order to take you a mile away from you house. That would render the algorithm pointless. In the same way the study of algorithm is important because it will teach you how to ensure that your code is accurate.

This doesn't meant that you won't ever make mistakes. The only programmer who doesn't make mistakes is the one who doesn't build any programs. However the study of algorithms will help you better understand how programs should work, which will in turn help you build accurate applications.

Growth as Developer

Last, but certainly not least, the most important reason why algorithms are important to study is because they will help make you a better developer. As I mentioned at the beginning of this guide my first taste of algorithms wasn't positive. The main issue was that I felt they were impractical and were wasting my time as a developer.

However, my attitude towards them started to change, quite suddenly. The change was caused when I was complaining to my professor that I didn't really see a point in spending my time on building algorithms that already had been integrated into languages. Her response was one that I'll remember my entire life. She gave me a list of basic algorithms and told me to go and build them from scratch.

I thought it would be pretty straightforward, she even let me use the pseudocode as reference, so there wasn't any question on what I was supposed to implement. To my surprise her request was quite challenging. In fact I really struggled to complete the assignment on time. The reason was because algorithms encompass essentially every component in a programming language.

For example, to implement the Quicksort algorithm I had to write code that included:

  • Partitioning
  • Swapping array values
  • Performing recursion
  • Using randomization

And that was simply for a single algorithm! Needless to say, by the end of the assignment I discovered that I had learned more about the language that I was working with than I had in years.

And that's my top reason for learning about algorithms. There's not really a reason for implementing your own sorting algorithm or creating a binary search tree. However in the course of learning algorithms you will discover advanced facets of a language along with programming paradigms that will give you an edge as a developer.