Published on

Behind The Algorithm #1 - Why do we need to be "Good" in writing Algorithms?



Hello guys, by this first post, I'll start to write series of posts to talk deeper about the Algorithm. In this series, we will discuss about the very fundamental theories and practices to write a good Algorithm.


🤔 Wait, the computer is becoming faster and faster...

So, why do we need to learn to write a good Algorithm? Is it worth learning? Is it going to bring a good impact on my career? Good questions! Let's talk about all of your questions!


Okay, let's talk about the WHY first. Maybe, our first motivation to learn about writing a good The algorithm is to pass the coding interview of our dream company to get our dream job. But believe me, it's more than that.

For example, writing a good Algorithm could become very useful in this situation: Suppose you have written an algorithm to find the best route for your drivers to deliver orders to your logistic company. Your algorithm would handle all of the tasks pretty quickly when the number of orders and drivers is pretty small, a hundred maybe. Even if you're executing it on a computer with minimum specs, your algorithm works well, and your boss is still happy with that. 😃

But suddenly, the number of orders grows exponentially as long as the number of drivers. But sadly, your algorithm's time complexity also grows exponentially. You have no time to optimize it, the DevOps team doing their job, the price of the cloud computing service is skyrocketing, and your boss is very unhappy right now. 😰

🤌 Efficiency

From the story above, we learned something. Sometimes, different algorithms designed to solve the same problem often differ dramatically in their efficiency. Even more significant rather than tweaking the hardware to execute it. That's why learning to design a good algorithm is 1000% worthwhile in my opinion.

Good Algorithm

This is a very broad topic to discuss. Because the term "good" is so unclear. It could be good in engineering practice, or good in some other perspectives.

In this series, we will be more focused to justify the algorithm by its correctness and its time and space complexity. So we will not go deeper and be more abstract in discussing the hardware that executes the algorithm.

Even maybe we will not specifically use one of the available programming languages. We will use a language commonly called pseudo-code. So we will free ourselves from any concern about the syntax or implementation of the specific programing language.

We will be more focused to talk about the techniques to write good algorithms and how to analyze the performance and the correctness of an algorithm, and we will have been doing a lot of practices by solving a lot of problems together to understand more about the fundamentals of the algorithm design practice.

And by those knowledge, I hope that we could be more fluent to write good algorithms to solve our day-to-day problems.

These series are written as my notes when reading this book: Introduction To Algorithm: 3rd Edition

📔 Behind The Algorithm Series

  1. Behind The Algorithm #1 - Why do we need to be "Good" in writing Algorithms?
  2. Behind The Algorithm #2 - What is an Algorithm?
  3. Behind The Algorithm #3 - ⏱ Running Time & Time Complexity
  4. Behind The Algorithm #4 - 👨🏻‍💻 How to design an Algorithm?