Friday, August 7, 2009

What is algorithm?

An algorithm is a step by step finite set of instruction for solving a problem. Its a description, a computational method of how a certain set of input is transferred to a desired set of output.

A good algorithm has at least the following properties:
  • It solves the given problem
  • It is precise and unambiguous i.e. it is obvious and totally clear what each instruction is meant to accomplish
  • It is simple and detailed enough for a computer to follow
  • It does what it is meant to do i.e. it works correctly
  • It defines the correct order of execution
  • It is finite. The algorithm must terminate after a finite number of operations

Following three constructs are needed to describe an algorithm:

1. Sequence: The instruction must be followed in a given order.
2. Selection: Execution of the path of a part of the algorithm depends on the circumstances. Example: if... else.
3. Repetition(iteration): A part of the algorithm may be repeated several times.

Previous post

Next post

No comments:

Post a Comment