Introduction
In this blog, we are going to learn what is Algorithm and the way to measure an Algorithm/ function.
What is Algorithm
An algorithm is a procedure used for solving a problem or performing a computation.
Algorithms use an initial input along with a set of instructions. The input is the initial data needed to make decisions and can be represented in the form of numbers or words. The input data gets put through a set of instructions, or computations, which can include arithmetic and decision-making processes.
Let's take an example,
- We have a clock to measure the amount of time taken to complete work
- Speedometer to check how fast any car moving
- BP monitor to measure our Blood pressure
In similar ways, there should be tools to measure our Algorithm/ function.
Way to measure our Algorithm
There are two ways by which we can measure our algorithm so that we will get to know how it is performing.
- Time complexity - Amount of time taken by the algorithm to execute.
- Space Complexity - Measure how much space our Algorithm is taking in memory.
Summary
In this blog, we learned what is Algorithm and different ways to measure algorithms. In the next blog, we will learn more about Time complexity and space complexity with example.