Algorithms (Characteristics, Guidelines & Advantages)
Algorithm Introduction
An algorithm is an effective step-by-step procedure for solving a problem in a finite number of steps. In other words, it is a finite set of well-defined instructions or step-by-step description of the procedure written in human readable language for solving a given problem. An algorithm itself is division of a problem into small steps which are ordered in sequence and easily understandable. Algorithms are very important to the way computers process information, because a computer program is basically an algorithm that tells computer what specific tasks to perform in what specific order to accomplish a specific task. The same problem can be solved with different methods. So, for solving the same problem, different algorithms can be designed. In these algorithms, number of steps, time and efforts may vary more or less.
Characteristics of an Algorithm
An algorithm must possess following characteristics :
- Finiteness: An algorithm should have finite number of steps and it should end after a finite time.
- Input: An algorithm may have many inputs or no inputs at all.
- Output: It should result at least one output.
- Definiteness: Each step must be clear, well-defined and precise. There should be no any ambiguity.
- Effectiveness: Each step must be simple and should take a finite amount of time.
Guidelines for Developing an Algorithm
Following guidelines must be followed while developing an algorithm :
- An algorithm will be enclosed by START (or BEGIN) and STOP (or END).
- To accept data from user, generally used statements are INPUT, READ, GET or OBTAIN.
- To display result or any message, generally used statements are PRINT, DISPLAY, or WRITE.
- Generally, COMPUTE or CALCULATE is used while describing mathematical expressions and based on situation relevant operators can be used.
Example of an Algorithm
Algorithm : Calculation of Simple Interest
Step 1: Start Step 2: Read principle (P), time (T) and rate (R) Step 3: Calculate I = P*T*R/100 Step 4: Print I as Interest Step 5: Stop
Advantages of an Algorithm
Designing an algorithm has following advantages :
- Effective Communication: Since algorithm is written in English like language, it is simple to understand step-by-step solution of the problems.
- Easy Debugging: Well-designed algorithm makes debugging easy so that we can identify logical error in the program.
- Easy ann Efficient Coding: An algorithm acts as a blueprint of a program and helps during program development.
- Independent of Programming Language: An algorithm is independent of programming languages and can be easily coded using any high level language.
Disadvantages of an Algorithm
An algorithm has following disadvantages :
- Developing algorithm for complex problems would be time consuming and difficult to understand.
- Understanding complex logic through algorithms can be very difficult.