Time complexity refers to the time taken by a program to complete its execution. It is measured using the Big O notation. Big O notation is a language and a metric that is used to describe the efficiency of algorithms. Without understanding Big O notations, it is not possible to create efficient algorithms. If we don’t know when our algorithm gets faster or slower, we’ll struggle to judge our program performance. This concept gives us one way of describing how the time it takes to execute our program grows as the size of input grows. For example, a sorting algorithm might be quicker to sort a smaller array but as the size of the array increases, the time taken to sort the array using the same algorithm might increase drastically. In such cases, other sorting algorithms might turn out to be useful. Time is not the only thing that matters in an algorithm. We might also care about the amount of memory or the space that is being consumed by the algorithm or the program. It is a parallel concept to time complexity. Space complexity is the measure of the amount of working storage that a program needs. As with time complexity, here we are concerned with how the space that is needed grows as the size of the input grows. For example, a smaller array will consume a lesser space than compared to a larger array. If you are using too many variables to store intermediate computations in your program then you might end up consuming more space.