Analysis of Algorithm: INTRODUCTION – ANALYZING CONTROL STRUCTURES-AVERAGE CASE ANALYSIS-SOLVING RECURRENCES.
ALGORITHM
Informal Definition: An Algorithm is any well-defined computational procedure that takes some value or set of values as Input and produces a set of values or some value as output. Thus algorithm is a sequence of computational steps that transforms the i/p into the o/p.
Formal Definition: An Algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition, all algorithms should satisfy the following criteria.
1. INPUT Zero or more quantities are externally supplied.
2. OUTPUT At least one quantity is produced.
3. DEFINITENESS Each instruction is clear and unambiguous.
4. FINITENESS If we trace out the instructions of an algorithm, then for all cases, the algorithm terminates after a finite number of steps.
5. EFFECTIVENESS Every instruction must very basic so that it can be carried out, in principle, by a person using only pencil & paper.
Issues or study of Algorithm:
• How to device or design an algorithm creating and algorithm.
• How to express an algorithm definiteness.
• How to analysis an algorithm time and space complexity.
• How to validate an algorithm fitness.
• Testing the algorithm checking for error. Algorithm Specification:
Algorithm can be described in three ways.
1. Natural language like English: When this way is choused care should be taken, we should ensure that each & every statement is definite.
2. Graphic representation called flowchart: This method will work well when the algorithm is small& simple.
3. Pseudo-code Method: In this method, we should typically describe algorithms