An algorithm has been such a pain in the neck for me since the course began. It made me feel back in time when I was 13 and started learning complex math at school.
I did not think the meaning of algorithm until now, or rather, I did not have a space in my brain to wonder.
So, I researched.
What is an algorithm? -- It is a way and procedure to solve problems.
It sounds very mathematical. However, you are using algorithms in your everyday life.
When you go to school, you
- leave your house.
- walk to a train station.
- take a train.
- get off the train.
- walk to school.
When you want to make a sandwich, you
- peel and wash lettuce.
- slice tomato.
- paste mayonnaise on breads.
- put lettuce and tomato on a bread.
- sandwich with another bread.
Just like these examples, we use algorithms unconsciously.
When coding, it can be illustrated as if you are telling someone to cook pasta, and this person doesn't know how to cook.
In this case, the person is a computer and your direction is a code.
Okay, it sounds less scary now.
What is it used for in our daily lives? --Many many things.
They range from dating apps to solar panels on ISS. Probably, the most popular one is Google search.
Google search uses an algorithm to optimise search result. It is updated on a regular basis and number of variables is enormous. It is almost impossible to understand all.
Another one that we use often is a navigation app. It searches the fastest route to go to one place from another.
Social networks such as twitter and Facebook also uses an algorithm to show information that is assumed to be important to you. This information is based on what you post, your friends and browsing history.
Lastly, dating apps, which are similar to the above. They gather data from you, whether you like someone tall/short, with/without beard, outgoing/stay-at-home type, etc. Based on these, a computer suggests people you might like.
More detailed explanation
Let's pick navigation apps to take a look in detail. The algorithm used for navigation is called Dijkstra method.
Here is how it works:
A is the current location and E is the destination. Numbers are time that needed to go to each nodes connected with paths.
There are three paths from node A, and we look for the closest node.
The closest is node D. From there, there is only one path. So we calculate time, which is 5 + 9 = 14.
Second closest node is B. There are two paths, but we can go to node C directly from A. In this case, we discard that path and only calculates the path to E, 6 + 6 =12. The sum is smaller than 14, so we keep this route as the fastest.
We do the same with third path from node A. We can go to node B directly from A, and only the path to node E is calculated, which is 8 + 5 = 13. This route is also longer than the one before.
The result will be A - B - E route.
Knowing what algorithms are used for gave me a clear view to study them.
There are tons of things that can be done with them and they make me wonder what I can do in the future.
*One last thing before going back to studying...
While researching, I suddenly recalled a song that is played in a TV show for toddlers in Japan. The song is called "Algorithm Koshin" (Algorithm March).
One website taught me that this march falls into a pipeline processing. It reduces time for running algorithm, and it is also used for improving CPU capability.
It is surprising that I could learn algorithm from a song!
Top comments (0)