# Why you should learn algorithms even as a non-programmer

Let me start with a short story: There was once a king that loves playing chess. One day a famous traveling sage was challenged by the king. The king wants him to play so badly that he let the sage name his own reward. The sage said: I would like the reward in the form of rice on chess square. 1 grain on the first square, 2 on the second, 4 on the third, 9 on the fourth and so on.

I am sure at this point you have realized that this is an exponential growth under the disguise of rice payment. If you were the king, you’d know that you have to put 1,000,000 on the twentieth square and on the final square, you would have to put more than 18,000,000,000,000,000,000 grains of rice. Little did the king know, by agreeing to the terms, he is potentially handing his country to the sage.

This story is not written by a modern mathematician or programmer, more importantly, it doesn’t take a computer to wrap your mind around it — all it takes is a curious mind and the ability to see things for what it is, not what it appears to be.

What does it mean to see things for what it is, not what it appears to be? You may ask.

The human population, with food and cures of diseases, will grow almost exponentially. (Similar to what you see after 10,000 BC in the world population illustration).

Bacterias, under optimal conditions, through binary fission, splits from one to two daughter organisms, which then each split to form four, eight, and so on.

So does viruses — most recently, the Coronavirus.

People, without any knowledge about how exponential growth works mathematically, uses this concept well.

In the 1920s, Charles Ponzi carried out the famous Ponzi scheme — also known as the pyramid scheme that promises ‘high returns with little risk’ given that an exponential growth of victims are recruited.

Exponential growth is merely an example here to explain why algorithms are not just about numbers, they are the essence of what we see in our lives. Our minds picks up informations from what we see, filters out the disguise and collects what remains the same underneath.

You may now ask what do we do to see the essence? To see what remains the same ?

The answer is very simple, and it surely does not take a degree in computer science or even a college degree to tell you: critical thinking. I think this ability may come easy for some people and a bit harder for others. Despite the difficulty, it is an ability that can be learned, and need to be learned if one were to become a software engineer. Because without it, it would be very, very hard to solve any problems.

Learning about algorithms is a very good way to start training yourself to start thinking about the essence — or the abstracts. Essentially, solving algorithms problems is implementing a method that is independent of the particular programming language being used, the method should be able to solve a defined group of problems— not an instance and it should solve it as efficiently and effectively as possible. A great example is using Euclid’s algorithms for finding the greatest common divider of two numbers:

The function is based on a simple assumption that if the GCD divides both A and B, it will divide A-B. We are fairly versed in doing multiplication, subtraction or division but to leverage that to solve problem like this doesn’t come to us intuitively.

`var gcd = function(a, b) {     if (!b) {         return a;     }     return gcd(b, a % b);  };`

The pseudocode for The Euclidean Algorithm for finding GCD(A,B) is as follows:

• If A = 0 then GCD(A,B)=B, since the GCD(0,B)=B, and we can stop.
• If B = 0 then GCD(A,B)=A, since the GCD(A,0)=A, and we can stop.
• Write A in quotient remainder form (A = B⋅Q + R)
• Find GCD(B,R) using the Euclidean Algorithm since GCD(A,B) = GCD(B,R)

Here is a link to further provides proof behind this algorithm: https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/the-euclidean-algorithm

I was amazed by the elegance of it at first sight and I knew that I cannot come up with something this concise. It is describing a problem in such a concise way that an article, a book or any words cannot achieve. It is on top of emotions or feelings but just a pure form of truth.

We are lucky to have been born in this century that a lot of the algorithms have already been written and widespread. Instead of writing our own algorithms, a lot of the times we just need to learn them and know how to choose the best algorithm for our own work scenario.

So the question comes back: How do I learn an algorithm from the bottom of my heart?

I would suggest one of the best learning strategy out here: The Feynman Technique.

# Keep it simple and short:

Can a toddler understand what you just said about Fibonacci numbers? Did you start yawning midway or was it short enough to keep him interested?

If you teaching is like wikipedia:

Fibonacci numbers are strongly related to the golden ratio: Binet’s formula expresses the nth Fibonacci number in terms of n and the golden ratio, and implies that the ratio of two consecutive Fibonacci numbers tends to the golden ratio as n increases.

The calculation goes as: F0 = 0, F1 = 1, Fn = Fn-1 + Fn-2

A toddler would not understand and nothing you just said is going to help yourself to understand neither — just a repetition of the solution.

What you want to do is to write it down with him, what the rules are and how numbers are calculated. Or even better, show him a picture:

Interest him with the fact that Fibonacci occurs in nature!

As a student, I genuinely think there’s never an end to learning and I hope my article can help you a little bit in explaining why learning algorithms can be very helpful — even for a non programmer.