What is an Algorithm?
An Algorithm is a step-by-step procedure, which defines a set of rules to be executed in a specific order to get the desired output.
Characteristics of Algorithm:
- Language independent
- Feasible
- Unambiguous
- Finiteness
- Well-define input
- Output (should match the desired output)
Analysis of Algorithm
Analysis of the algorithm is the process of analyzing the problem-solving capability of the algorithm in terms of the time and size required. There are two different stages to perform efficiency of an algorithm, before and after implementation.
Complexity of Algorithm
The complexity of an algorithm is a measure of the amount of time and/or space required by an algorithm
Time Complexity: An amount of time that needs to execute an algorithm.
Space Complexity: A storage of memory that requires to execute an algorithm
How to design an Algorithm.
Design an algorithm to add two numbers.
Step 1 − START
Step 2 − declare three integers a, b & add
Step 3 − define values of a & b
Step 4 − add values of a & b
Step 5 − store output of step 4 to add
Step 6 − print add
Step 7 – STOP