Space Complexity refers to the amount of memory or space an algorithm takes to run as a function of the length of the input.
Like time complexity, which is a measure of the amount of time an algorithm takes to run as a function of the length of the input, space complexity is a way to evaluate the performance of an algorithm.
In cases where there is more than one way to solve a problem or achieve a result, measures of memory or space are often important to those who are proposing or implementing solutions. All other things being equal, a solution that is more resource-intensive with respect to the amount of memory or space needed are less desirable than their more efficient counterparts.
“After settling on the programs that are all candidates for solving the problems at hand, technical teams typically test these programs’ performance. One of these is the proposed solutions’ space complexity, or the amount of memory it requires to perform the exact tests at hand with realistic sample inputs.”