- 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-
- Complete :- An algorithm must be a complete solution for the given problem.
- Finite :- An algorithm must be completed into finite no. of steps. There must not be any infinite loop within the solution.
- No. of output :- An algorithm must has to produce at least one output.
- No. of input :- An algorithm may or may not take the input.
An algorithm is written using some special words and symbols :-
- Start :- To show the beginning of algorithm.
- Stop :- To show the end of algorithm.
- Input :- To accept the input from user.
- Output :- To show the output.
- := :- Assignment
- If.....else :- Used for conditional work
- 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-
- Posterio analysis
- 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.
0 Comments
Tell us your queries or more topics which you want