Algorithms

December 10, 2020

Algorithm

An algorithm is a sequence of steps to be carried out in order to solve a given problem.

Characteristics of Algorithm:

It includes:

  1. Input: An algorithm must work on externally provided one or more input.
  2. Output: An algorithm must provide one or more output.
  3. Finiteness: An algorithm must terminate after finite number of steps.
  4. Definiteness: The steps of an algorithm must be definite without leading to multiple meanings.
  5. Effectiveness: The steps of an algorithm must be effective so that it can be solved easily.

Analysis of Algorithm

An algorithm can be analysed for its performance based on time and storage it needs. The time required by an algorithm is known as time complexity and the storage required by the algorithm is known as space complexity.

Time Complexity

The total amount of computer time needed to complete the execution of an algorithm is called as time complexity.

Space Complexity

The total amount of computer memory needed to complete the execution of an algorithm means a program is called space complexity. It includes fixed space like code, statement, instructions, constants and variables, like problem dependent variables, stacks.

Different Types of Algorithm


Written by Anushka Raj who likes to teach programming and work on front-end technologies. Follow me on Twitter and Instagram.