/  Data Structures – Tutorial

Time and Space Complexity in Data Structure

 

Algorithm Analysis

The efficiency of an algorithm can be analyzed in two different stages, i.e before implementation and after implementation. 

  1. Priori Analysis
  2. Posteriori Analysis

 

Algorithm Complexity

There are two main factors that determine the efficiency of an algorithm:

  1. The Time Factor
  2. The Space Factor

 

Space Complexity

It is a representation of the amount of space needed by the algorithm in its life cycle, which is equal to the sum of a fixed part required to store data and variables, and a variable part required by the variables.

 

Time Complexity

It is a representation of the amount of time required by the algorithm for its completion. It can be denoted as a numerical function, that can be measured as a number of steps where every step takes constant time. 

 

Reference 

Time and Space Complexity in Data Structure