“What is the purpose of studying those algorithm questions if you are never going to use it in your job?”
I am sure you heard about this around in the tech industry – to get a job at the xxx company, you have to study your data structure and learn algorithm questions to pass the interview rounds.
Studying algorithms and data structure might seem useless, but what you learn from studying those materials ended up being useful in solving your day to day problem.
Let me explain with an analogy about learning history.
Why do we need to know about history?
It is a waste of time to take a student loan in college to learn about the Qin Dynasty Period, and to study Hannibal’s tactics in the Second Punic War, or how German statesman created the First World War, Bismarck declared war on Russia.
Those stories are great, but you never will implement those stories in your future or present.
Yet, history is one of the general educations, must-have classes in high school. After you graduated from high school, you will need to take history as a general education. However, like most of your parents said, learning history doesn’t help you to earn a six-figure salary. Fifty percent of the history major graduates ended up becoming Elementary & secondary schools.
Moreover, learning history doesn’t help us predict the future either. It seldom worked out because the future is just too hard to predict. If you want to learn to predict the future, learning linear algebra.
If the knowledge in history is useless in modern society, why is it a must-have class in elementary, secondary, high school, and college?
Yuval Noah Harari said it precisely, “Historians study the past not to repeat it, but to be liberated from it.”
We think that we were born into historical reality, and that gives certain particular norms and values. We are taking this reality for granted and thinking that it is immutable. By studying the past, we can escape for that thought of immutability. We will never forget that a chain of events creates our current world situations. We are not held by some sort of spell that we are born in a particular condition that dictates our life, values, and thoughts.
Studying history helps us change and rewrite it. It helps us think that the current situation is not eternal and that there has been “different” for once.
"If there are no movements about African Americans strike back for abolish slavery and equality, employment strike for benefits and human rights, women strike for feminism and to take possession of their own bodies - we will also think that those values are natural and inescapable part of who we are."
Studying history has far more impact in today’s society that you can ever imagine, and the same goes for the algorithm.
Until recent decades, life science demonstrated how all living beings are consist of the algorithm. The emotions that you have are a part of biochemical algorithm. The decisions that you made each day are wired with thousands of precise data in your brain that lets you choose one over the other through probability. You didn’t know that you have thought through all these probabilities and complex algorithms because your brain has done it for you subconsciously.
The algorithm is arguably the most critical concept that you need to know in the 21st century.
Before answering why it is essential for you to study algorithms, you need to know what an algorithm is.
The algorithm is a set of steps for you to do specific calculations, problems, or decisions.
The algorithm is not the calculation itself, but it is the set of steps that are leading up to that calculations.
For instance, how do you find Ace of Heart in a deck of cards? First, you can go through every single card in the deck. Second, if the card is an Ace of Heart, then you found it.
Now, this is the algorithm to find Ace of Heart in a deck of cards. If you remove the input (card) and replace it with all colors of candy, you can still use the same algorithm to find the color of the candy you want.
Algorithms are very powerful because it is a recipe for evaluating calculation. It is the reason why artificial intelligence exists because learning something can be breakdown into a set of algorithms. What machine learning necessarily do is to refine the decisions that it made to the result that we wanted.
The action of implementing the algorithm on a set of problems, calculations, and decisions is called Problem Solving.
Problem Solving is one of the critical skill sets that all companies want in the 21st century. All the brain teasers, case study questions, algorithms, and data structure questions that the company gives you on your interview are testing you the ability to implement an algorithm to solve a specific set of problems.
Besides testing you the ability to derive an algorithm from a given problem or calculation, they also want to see how you are when you struggle – will you keep trying a different method to solve the issues? Will you ask for clarifying questions to understand more about the underlying problems that are given? Will you get frustrated when you are struggling? Are you willing to take on any suggestions when you are working towards the solutions?
Aside from cracking the coding interview, studying algorithm and learning them helps you think about your life differently.
After I finish learning all sorts of the algorithm to solve coding questions, I started to find the pattern on solving each problem. I began to see that all issues consist of a smaller problem and that each problem has a base case. I started to see my daily life, the goods, and the bad as a set of questions to solve.
I can understand the root cause of the problem quickly because I can break down that problem into a smaller portion.
For instance, some of my colleagues have a hard time meal prepping for the week because they don’t have time to do so. They often said to me, “How do you have the time to meal prep during the week?” I tell them that I prepare a dish on the weekend in bulk, pack them into my lunch box, and eat the same bowl every day. Then, I will ask them, “How do you not have the time to meal prep for the week?” They often said that they don’t have enough time for the weekends. Then I’ll ask them, “What do you usually do at the weekends?” “I usually hang out with my family, play some games ….” You can see where I am going. I am breaking down the more significant problem into a smaller once and know the root cause of it. By the end of the conversation, some of them will say that they don’t like eating the same food each day. Therefore, they don’t want to spend the time to think about what kind of food to eat from Monday to Friday. That’s the root problem, and once you found that root problem, you can alter your daily system (algorithm) to accommodate that.
You will still be using an algorithm in your work as a software engineer.
You will need to understand the concept and theory underlying the existing system to create a faster version of the system no matter what kind of position and job that you do as a software engineer.
If you have no idea about how to use recursion to solve a combination question, how are you going to implement a tic tac toe bot?
If you don’t know about the power of immutability and pure function, then you will create a concurrent application that is not clean and safe.
The algorithm is centered around our daily life, and it is the concept behind problem-solving. The algorithm itself cannot produce any beneficial outcome. You need to have someone to take that action and follow its instruction to see its result.
The powerful thing about algorithms relies on it can be used dozens of times with a different input that will have resulted in slightly different output. However, the production that you want remains the same.
Whether you know it or not, the world is consisting of a series of the algorithm that powers us through our day and night.