What is an Algorithm
For Complete YouTube Video: Click Here
In this class, we will try to understand What is an Algorithm.
This class is the first class of our course, Design, and Analysis of Algorithms.
The prerequisite for this course is the data structures course.
What is an Algorithm
An algorithm is a sequence of computational steps to solve any problem.
To better understand, we will consider a real-world analogy.
In our day-to-day life, whatever the work we do, knowingly or unknowingly, consciously or unconsciously, to complete the job, we follow some steps.
For example, How to prepare milk for breakfast?
Step 01:
Pour the milk into the container
Step 02:
Place the container on the gas stove
Step 03:
Turn on the gas
Step 04:
Add some sugar
Step 05:
Boil the milk for 5 minutes
Step 06:
Turn off the gas after finishing
Similarly, to solve any computational problems, we will identify the steps for the solution.
To understand this consider the image shown below.
The above algorithm shows two steps to add two numbers.
The first step has two variables, a and b, with values of 10 and 20.
The second step is the sum of a and b.