Space Complexity
When using data structures if one more element is needed every time n increases by 1 then the algorithm will use o n.
Space complexity. Variables this includes the constant values and temporary values. The previous example ofo 1 space complexity runs in o n time complexity. In a sense space complexity is the base consideration.
Time and space complexity depends on lots of things like hardware operating system processors etc. Techopedia explains space complexity. Space complexity of an algorithm is total space taken by the algorithm with respect to the input size.
Even if an algorithm is painfully s l o o o o w w it can still run but if the space required by an algorithm exceeds the allotted memory of. We know that to execute an algorithm it must be loaded in the main memory. The term space complexity is misused for auxiliary space at many places.
The space complexity of an algorithm or a computer program is the amount of memory space required to solve an instance of the computational problem as a function of characteristics of the input. Sometime auxiliary space is confused with space complexity. The memory can be used in different forms.
But auxiliary space is the extra space or the temporary space used by the algorithm during it s execution. Space complexity includes both auxiliary space and space used by input. Space complexity is a measure of the amount of working storage an algorithm needs.
Auxiliary space is the extra space or temporary space used by an algorithm. That means how much memory in the worst case is needed at any point in the algorithm. Similarly space complexity of an algorithm quantifies the amount of space or memory taken by an algorithm to run as a function of the length of the input.