Almost everything in life is done with a specific pattern. Some examples include: solving a Rubik’s cube, running, biking, and even when just changing your clothes! But have you ever tried to cook without following its recipe, or to assemble a bike without relying on the manual? It might be possible, but it would be hard, and time-consuming especially for beginners.
Every time we wake up in the morning, we execute daily routines like when to turn off the alarm, fix our bed, take a bath, eat our meal, brush our teeth or go to school/work. If we analyze those daily activities, we can see logical patterns in them; to be more explicit, we call them “procedures,” “processes,” or “instructions.” However, in the web development industry and in it’s behind the scenes, this computer term is known as “algorithm.”
Get to know the Algorithm
A computer is just a pile of metals, wires, some plastic and other resources which can’t perform anything unless it is commanded to do so. To work properly, and serve its purpose, it requires step-by-step instructions or user inputs. And most commands should be written in a language or program that a computer understands. Therefore, you must learn how to code because it tells the computer what to do.
Where do algorithms fit on this equation? The “how” part is where it takes place.
When done properly, algorithms can perform a series of processes, like take, identify and sorts inputs correctly to create outputs.
Origin of Algorithm
The word “algorithm” may be new to some people but little did they know, it can be traced back to the 9th century. Abdullah Muhammad bin Musa al-Khwarizmi, known as “The father of Algebra” was a Persian astronomer, scientist, and mathematician whose book was translated into Latin, where his name was translated as “Algorithmi.”
In the 12th century, Abdullah Muhammad bin Musa al-Khwarizmi, a Persian astronomer, scientist and mathematician who was known as “The father of Algebra,” had a book translated into Latin. His name was translated as “Algorithmi.”
Since then, it has been working behind the scenes. It decides what results you would see on your monitor or smartphones when you search on the internet, and they choose whose friend’s post you get to see first. It’s already shaping our online experience and has become really helpful in our daily lives.
Even though it was there long before the computers of today, the algorithm is one of the foundations of computing and technology. Everything we do that involves any piece of technology works through algorithms. The benefits we all get from it include; (1) faster problem-solving, (2) more efficient results and (3) faster way of performing tasks and output.
Algorithms make problem-solving easier and more rational. It identifies the process, major decisions to make and the required execution to solve a problem. Thanks to algorithm our emails know where they should be sent, our messages are delivered in real-time, video calls with our loved ones from the other side of the world are possible, we can watch our favorite drama or movies anywhere we go with our smartphones, we enjoy games and apps online and even offline, and many more.
Artificial intelligence, machine learning, deep learning, and other sub-field of technology work through algorithms. Without it, we wouldn’t have better internet experience, real-time and fast results. And to provide better and quicker output, there are different kinds of way algorithms approach problems or perform tasks. Here are some of them:
Different Kinds of Algorithm
Like I mentioned earlier, algorithms try to solve problems by breaking it into small and manageable problems. Like a wise leader who distributes the work to his teammate for better and more efficient results.
Through addressing the divided subproblems, it discovers the solution for the original problem. Once the subproblems are solved, they are combined with each other and produce accurate output.
You might ask, “Is there any difference between Decrease and Conquer and Divide and Conquer?” Well, the answer is yes, there is. While divide and conquer break into small subproblems, decrease and conquer algorithm—from the word “decrease” itself—reduces the problem instead of dividing it.
It shrinks the problem instance into a smaller instance of the original problem. Once solved, the smaller instance is extended to solve the original problem.
A Greedy Algorithm is a mathematical process that works by recursively constructing a set of items from the smallest parts. It provides straightforward and easy to understand solutions. This algorithm looks for a simple solution to complex problems by choosing the next step which will be the most beneficial.
It doesn’t consider the problem as a whole; instead, it provides an immediate output to the smaller instances. That’s why it is called “greedy.”
Brute force algorithm is a kind of algorithm that attempts to solve a problem straightforwardly by using a large number of patterns. It will go through all possible solutions and find the best option or solution. However, this method is not always efficient, and it’s also time-consuming.
Backtracking Algorithm is almost like the Brute Force algorithm, but unlike the previous method which finds all the possible solutions and picks the best one, this one finds the solution by trying all options one by one. It’s like a trial and error way of problem-solving. If the first option isn’t the answer, it’ll go back to the other options and tries another. This process repeats until the solution to the problem is found.
The jigsaw puzzle can be an example. Pick one piece and try if it fits the puzzle, if not, try another piece until you find the right one. This algorithm goes on until the whole puzzle is solved and the picture is completed.
Algorithm: The Silent Worker Behind the Scenes
“The algorithms that orchestrate our ads are starting to orchestrate our lives,” said Eli Pariser, the CEO of Upworthy, a website for “meaningful” viral content, a left-wing political and internet activist, the board president of MoveOn.org and a co-founder of Avaaz.org.
In this generation, most of us have our own smartphones or tablet, some with computers and laptops that we use on a daily basis. Many people today may be taking algorithms for granted and might think it’s unnecessary or unimportant, but hey, because of them, life today is a lot easier than before. We might not notice them nor see them, but they work behind the scenes to make our lives convenient.
Know more about algorithms by joining us at Coding Dojo in live lectures for four weeks and learn Algorithms with us. Aside from live lectures, we also have Q&A sessions with Coding Dojo instructors, to help you better understand the materials. The classes will start on the 26th of November. Let us help you know more about algorithms and let us learn together! Click here for more information, www.codingdojo.com/academy/algorithms.