Subscribe Us

header ads

What is an Algorithm? Characteristics and types of analysis of Algorithms

Algorithm :-
  • The step by step procedure to solve a problem is called algorithm.
  • It is a tool to develop the logic of a program.
  • In software development first of all the algorithm for a particular problem is developed then their program is written using a specific language.


Characteristics of Algorithm :-
For any algorithm, the following characteristics must hold good-
  1. Complete :- An algorithm must be a complete solution for the given problem.
  2. Finite :- An algorithm must be completed into finite no. of steps. There must not be any infinite loop within the solution.
  3. No. of output :- An algorithm must has to produce at least one output.
  4. No. of input :- An algorithm may or may not take the input.

An algorithm is written using some special words and symbols :-
  1. Start :- To show the beginning of algorithm.
  2. Stop :- To show the end of algorithm.
  3. Input :- To accept the input from user.
  4. Output :- To show the output.
  5.   :=       :- Assignment
  6. If.....else :- Used for conditional work
  7. Do....while :- Used for repeatational work.

Analysis of algorithm :-
  • An algorithm must be analysed to make the decision that the algorithm is effective or not.
  • In the analysis of algorithm we have to calculate the time complexity and the space complexity of the algorithm.
  • Calculation of time complexity and the space complexity is also known as specification of algorithm.

Types of analysis of algorithm :-
An algorithm can be analysed in two ways-
    1. Posterio analysis
    2. Priory analysis

Posterio Analysis :-
  • In this method of algorithmic analysis an algorithm is implemented as program first and then the time and the space used by that program is calculated.
  • In this method the time and space complexity is calculated after the execution of program, so it is known as posterio analysis.
  • This method of analysis gives accurate result of time complexity and space complexity but it is not used in industry.

Priory Analysis :-
  • In this method of algorithmic analysis the time complexity an the space complexity of an algorithm is calculated before the programming.
  • In this method of analysis, we calculate the time and the space complexity before the execution or before the development of program, so it is known as priory analysis.
  • This method of algorithmic analysis is difficult than posterio analysis.
  • This analysis gives approximate result for time and space complexity.
  • In this analysis we consider that every statements of a program consume one unit of time and every data consume one unit of space.
  • In practical the priory analysis is used, however it doesn't give the exact value.

Post a Comment

0 Comments