The field of Computer Science revolves around writing of programs for several problems for various domains. A program consists of data structures and algorithms. An algorithms is a set of steps required to solve a problem. These steps are performed on a sample data representing an instance of the problem. Thus an algorithm maps a set of input data to a set of output data through a sequence of operations. An algorithm must have the following properties:

  1. Input: Input data, supplied externally
  2. Output: Result of the program
  3. Finiteness: In every case, algorithm terminates after finite number of steps.
  4. Definiteness: The steps should be clear and unambiguous.
  5. Effectiveness: An Algorithm should be written using basic instructions. It should be feasible to convert the algorithm in a computer program.

The algorithm is basically a set of steps written to reduce the complexity of the actual program. Writing an algorithm is essential for any program in absolutely any programming language.