Time And Space Complexity of Data Structure and Sorting Algorithms

Hey There,
Some algorithms are more efficient than others. We would prefer to chose an efficient algorithm, so it would be nice to have metrics for comparing algorithm efficiency.
The complexity of an algorithm is a function describing the efficiency of the algorithm in terms of the amount of data the algorithm must process. There are two main complexity measures of the efficiency of an algorithm:
1. Time complexity is a function describing the amount of time an algorithm takes in terms of the amount of input to the algorithm. In layman’s terms, We can say time complexity is sum of number of times each statements gets executed.
2. Space complexity is a function describing the amount of memory (space) an algorithm takes in terms of the amount of input to the algorithm. When we say “this algorithm takes constant extra space,” because the amount of extra memory needed doesn’t vary with the number of items processed.
Let’s take a look at Time And Space Complexity for Common Data Structure Operations and various Array Sorting Algorithms

Sorting Algorithms

Best of luck! If you liked this guide, feel free to forward it along! Please drop a mail with your comments info@gildacademy.in
