What is an Algorithm? ( 5 Min Simple Explanation)

Algorithm

Before I start I would like to tell you that I really appreciate your interest in Programming and technology. 

This blog will help you get an understanding of what are algorithms. We can understand this easily by using examples.

Now consider we have a room full of people and you want to count the number of people and you want to find out how many are there. When you do it yourself you look at each person in the room and then declare the number of people in the room.

You manually counting, is also an algorithm. However, modern computer algorithms are used for many things like quantum computing, cloud computing, artificial intelligence and so many other things in the digital world.


according to Wikipedia,

an algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always unambiguous and are used as specifications for performing calculations, data processing, automated reasoning, and other tasks.

but thinking of this more simply,

Almost all the tasks we do in our daily life can be converted into an algorithm... if you take a typical example of why many motivational speakers and preachers say that humans are working like robots is because there are just so many people in the world who just get up, do daily chores, work, watch tv, and get back to bed and then repeat...

making the whole life just drift without a lot of meaning. Hope all of you don't do that...

but anyways coming back to a tech if you label all these tasks and then make an order for them and put them to loop... there you go an algorithm.

This is something like a very basic explanation of the probably the easiest algorithm. Doing one task after the other and repeating it.

However, these kinda algorithms are not so useful ina modern world with so many complexities.

To explain how complexities can get added let me take up another example... let's say you are counting the number of files in a folder but we would like a computer to do it... so we make an algorithm.

The typical way to do it would be a just point out the number of folders and count mentally or using your fingers.

Depending on the language we would set a set of commands to calculate and update the number every time a change is made in the folder we could get the result.

So we could say something like ...

N = 0
and if there is another file

Then N = N+1,

now this would be like the way we typically count using our fingers counting one by one 


But then it's a computer address and we could do something more efficient, we could count 2 at a time just got down the whole counting 2 times faster make everything even more efficient in accounting files in a folder.

The problem is when the number of files in a folder is not even number. One file will end up left out due to the flaw in the code.

This is when you say programmer said that there is a bug software or something is not working did you to the changes in the environment and when there is a bug you need to the algorithm so that there's a better experience.

Now there would be two ways to fix this problem would be to use the normal algorithm in case the number of files was odd, but this would destroy the whole reason we made a better algorithm.

That's why we could make another condition... after counting all pairs if any single is left, add therefore fixing the bug and keeping the enhanced productivity.


If a robot, program, or AI would do this then it would do the same process based on the following procedures. It would consider the number of people in a room as 'N', t
hen it would consider the original value of  N = 0. After that, it would declare for every one person in the room N=N+1.
i.e

number of people = N
N=0
\\if there is another heat signature
N=N+1

Then it would run these set of instructions to complete the task of counting the number of people in the room.

Now let us say you want to this on a large scale. This time after considering N=0

for every 100 people in the room N = N+100, but this program has a bug as it can calculate only in hundreds.

 After considering N =0, for every 100 people in the room
 N= N+100
and if 1 remaining 
N= N+1

It will be made to run the program until all heat signatures are covered. Hence, giving the correct number of people in a room or a particular area.
So basically an Algorithm is a set of instructions or procedures to get the desired result run by a bot or AI.

After reading this article, I am pretty sure there must be a few questions in your mind. We are here to answer those questions! Just comment below!

Find us on Instagram!


Post a Comment

2 Comments