Algorithm – Definition with Examples

Home » Algorithm – Definition with Examples

What is An Algorithm?

An algorithm is a step-by-step process to solve a particular problem.

Think of it as a mathematical ‘recipe’ to get to the bottom of a problem. If you follow the steps, you’ll be able to get to the answer in no time!

Example of the algorithm: A simple example of an algorithm you use every day is your morning routine. Say you get up at 6:30 am to go to school. If you always get up, brush your teeth, drink water, go to the bathroom, and then have a bath, that can be the algorithm your body follows! Algorithms are all around us. It’s important to spot them to know how they function and later create our own.

real life algorithm

There are a lot of procedures we apply in day-to-day life that we don’t realize are algorithms.

They include:

  • Tying your shoelaces
  • The daily timetable you follow in school
  • The rules to algebra formulae, like addition and subtraction
  • A technique you follow while playing sports
  • The rules to games you play with friends

ALGORITHMS IN MATH

Definition of Math Algorithm

An algorithm in math is a procedure, a description of a set of steps that can be used to solve a mathematical computation.
For example, A step-by-step procedure used in long divisions is a common example of a mathematical algorithm.

Example of Math Algorithm: The process of solving a mathematical problem such as, “What is 82 divided by 3” could be achieved by doing the following algorithm:

How many times does 3 go into 8?

The answer is 2.

How many are left over? 2

Put the 2(tens) in front of the 3.

How many times does 3 go into 22?

The answer is 7, with a remainder of one.

And of course, the answer is 27 with a remainder of 1

Standard Algorithm for Addition 

standard algorithm for addition

There are four simple steps for the standard algorithm for addition:

Step 1: Line up the numbers vertically by matching the place values.

Step 2: Add together the numbers that share the same place value, starting with the ones column.

Step 3: Write the sum below each column.

Step 4: If the sum of a column is greater than 9, carry over the tens digit to the next column.

Standard Algorithm for Subtraction 

standard algorithm for subtraction

There are four simple steps for the standard algorithm for addition:

Step 1: Line up the numbers vertically by matching the place values.

Step 2: Subtract the numbers that share the same place value, starting with the ones column.

Step 3: Write the difference below each column.

Step 4: If the number on the top in a column is less than the number at the bottom, then regroup before subtracting.

Standard Algorithm for Multiplication

Follow the link to check the standard algorithm of multiplication. 
Advantages of Algorithms

Algorithms are essential because of the large variety of applications they are used in. Understanding how algorithms work is also crucial for developing problem-solving skills and building logical reasoning. Listed below are a few advantages of an algorithm:

  • The algorithm creation process allows you to look at something rationally and calculative manner, which helps greatly when it comes to solving different kinds of problems.
  • Algorithms aid in bridging the communication gap, where following the procedure will reach the solution needed without going over the process repeatedly. You can follow the rules set up beforehand to reach the solution quicker.
  • Algorithms use a definite procedure, and by using and optimizing them, people can solve problems much quicker. 
  • Algorithms are easy to debug because each step has its logical sequence.
  • When we use algorithms, we can break down the problems into smaller steps or pieces, and therefore a programmer can easily convert them into an actual program.

Once you understand the foundation of algorithms, you will be able to create your own, saving yourself a lot of time. With SplashLearn’s fun activities and games, you can put your mathematical skills to the test to find algorithms in the questions you solve.

Properties of Algorithms

Algorithms should be used to solve three objectives:

  • Correctly execute a task: The job you want to do should be carried out with the intended results.
  • Efficiently process the information given: Your system’s time and resources should be appropriately used to understand and later resolve the problem.
  • Be easily understood: Algorithms are meant to make a job easier and ideally should be kept at a fundamental understanding level.

Examples of algorithms in the real world

Many companies in the real world use algorithms to help their customers or grow their businesses and often try to improve those every day.

  • YouTube – When you watch a few videos by a specific channel, you’ll notice that more and more videos by the same channel get recommended to you. It is due to YouTube’s recommendation algorithm, which uses your previous history to present videos of the same kind to you so that you keep watching.
  • Social media – If you access the Explore Page on Instagram, you’ll notice that many posts are related to the ones you usually search for or like/comment on. The algorithm here identifies the posts you interact with and shows you more of such posts because it expects that you like to see such posts.
  • Google – Google uses a very famous algorithm called PageRank to sort search results into an order that shows the most visited and authentic sites at the top. This algorithm considers dozens of parameters and provides the websites you would like to find fast.
  • Ola/Uber – Cab sharing companies like Ola or Uber use positioning algorithms to help customers find vehicles close to them for an optimal experience. These global positioning algorithms also help drivers find the fastest routes to reach a certain destination. Algorithms also help ola/ uber to decide which customer they should pick first and drop first accordingly.
  • Facial recognition – Whenever companies require users to be verified, they can move past methods like user IDs and passwords to more secure authentications like facial recognition. Here, algorithms are used to identify a person and check if they have access to the things they want to get to.


Tips to Master Algorithms

You can master algorithms by learning how to spot them in your day-to-day life. After that, you can break down the algorithm into bite-sized steps. You might have to test it a few times to notice a pattern in the way something takes place, though once you find it, you’ll be able to spot it again and again.

Try to figure out why each step in a process takes place. Once you understand why something happens, you’ll be able to connect the dots easier and figure out the logical sequence of events. In addition, it comes in very handy for figuring out how to create algorithms for yourself. With the help of the fun activities and games on SplashLearn, you’ll be able to master the basics of algorithms in no time!

Solved Examples

Example 1: Write the steps for making peanut butter and jelly sandwich.

Answer: The steps for making peanut butter and jelly sandwich are:
Step 1: Take 2 slices of bread
Step 2: Apply peanut butter on one side of the slice.
Step 3: Apply jelly on one side of the other slice.
Step 4: Press both the slices of bread together

Example 2: Write steps for the standard algorithm of subtraction.

Answer: The standard algorithm for subtraction follows these 4 steps:
Step 1: Line up the numbers vertically by matching the place values.
Step 2: Subtract the numbers that share the same place value, starting with the ones 
             column.
Step 3: Write the difference below each column.
Step 4: If the number on the top in a column is less than the number at the bottom, then regroup before subtracting.

Example 3: Write an algorithm to know if a number is odd or even.

Answer: The algorithm to find whether a number is odd or even is:
Step 1: Divide the number by 2
Step 2: If the number is completely divisible by 2 it is even, else it is odd.

Example 4: Write an algorithm to find the area of rectangle

Answer: The algorithm to find the area of rectangle is:
Step 1: Record the length of the shorter side as ‘b’
Step 2: Record the length of the longer side as ‘l’
Step 3: Area of rectangle will be the product of ‘l’ and ‘b’

Frequently Asked Questions

An algorithm in Mathematics is a procedure, a set of steps describing how a mathematical problem can be solved. For example the step by step procedures of Long Division or decimal multiplication.

Algorithms are primarily used in computing. In day to day lives algorithms can be seen all around us solving our daily life problems. The Youtube and Netflix recommendations, Google search, GPS applications all are powered by algorithms.

Algorithms are hard to apply to bigger and more complex tasks. They are time-consuming. It is not always easy to show branching and looping in algorithms. It can be very challenging to understand complex logic applied in algorithms.

The steps of algorithms should be precisely stated. The algorithm receives input and produces an output after executing a finite number of instructions.


Algorithm – Definition with Examples

Numerical Expressions

Play Now
Algorithm – Definition with Examples

Factors and Multiples

Play Now
Algorithm – Definition with Examples

Prime and Composite Numbers

Play Now