Tutorials

Algorithm


Algorithm Basics


An algorithm can be defined as a finite set of step-wise instructions that should be followed to perform a specific task like solving a logical or a mathematical problem.

CHARACTERISTICS OF A GOOD ALGORITHM

  1. Input- It receives an input.
  2. Generality- It works on a set of inputs.
  3. Definiteness- The steps must be precisely defined.
  4. Uniqueness- The results of each step is uniquely defined and depends only on the input and the results of the previous steps.
  5. Finiteness- It stops after a finite number of instructions have been executed.
  6. Output- It produces the desired output.

WRITING AN ALGORITHM

  1. It is written in an English-like language.
  2. It should have an input.
  3. You can use the syntax of the language if you are taking an example of a programming language.
  4. You can include variables.
  5. You can define mathematical expressions to calculate result.
  6. You can refer to each step by a unique step number.
  7. It should perform some action or produce an output.

An algorithm is logically represented by flowchart.



Please Share this page
Views : 46