Properties of an Algorithm
Algorithm:
An algorithm is a set of steps to solve a particular problem. It is a set of step-by-step instructions that satisfy a certain set of properties.
Properties of Algorithm:
An algorithm is an effective, efficient method that can use to express the solution to any problem within a finite amount of space. It is also a well-defined formal language. There are five properties of an algorithm as given below:
1. Input: An algorithm should have some inputs.
2. Output: At least one output should be returned by the algorithm after the completion of the specific task based on the given inputs.
3. Definiteness: Every statement of the algorithm should be unambiguous.
4. Finiteness: No infinite loop should be allowed in an algorithm.
Example:
while(1<2) { number=number/2; }
5. Effectiveness: Writing an algorithm is a priori process of the actual implementation of the algorithm. So, a person should analyze the algorithm in a finite amount of time with a pen and paper to judge the performance for giving the final version of the algorithm.
Characteristics of Algorithm:
1. It is a Step-by-step procedure for solving any problem says an algorithm.
2. An algorithm is a finite set of instructions if followed and accomplishes a particular task.
3. It is a sequence of computational steps that transform the input into a valuable or required output.