Complexity of algorithm in data structure


Complexity of algorithm in data structure

Complexity of algorithm:

  • Space complexity 
    Time complexity

Complexity of algorithm measures how fast is the algorithm (time complexity) and what amount of memory it uses (space complexity) - time and memory - 2 basic resources in computations

In Data Structure, Complexity of algorithm to classify it on the bases of Space and Time complexity. An algorithm is set to be efficient and fast If it takes less time to execute and consume less memory space.

1. Space Complexity:

Space complexity is about the amount of memory space required by an algorithm during the execution of a program or an algorithm.

Space Complexity of Algorithm  S(n) is the number of units of memory used by an algorithm as a function of data size


2. Time Complexity:

Time Complexity of Algorithm is the number of dominating operations executed by the algorithm as the function of data size

Time complexity measures the amount of work done by the algorithm during solving the problem in the way which is independent on the implementation and particular input data.

Time complexity is all about how much time it consumed during the execution of the program.


Learn More:

Algorithms | Introduction to Algorithm

Types of Data Structure | Data Structure & Algorithm

Comments