Space complexity - Falmouth-Games-Academy/comp350-research-journal GitHub Wiki

Space Complexity

What is Space Complexity

The term space complexity is used to describe the amount of memory an algorithm requires during execution [1]. The author of the web article titled "What does 'Space Complexity' mean " [2] disagrees with W. Kuo and M. J. Zuo [1] definition of space complexity. The author of the web article [2] explains that the definition of 'Auxillary space' and space complexity are often confused. It would seem that W. Kuo and M. J. Zuo [1] have given the definition of Auxillary space as the definition of space complexity. The web article [2] claims that the actual definition for the term space complexity is the total space taken by the algorithm with respect to the input size.

During execution an algorithm will use memory space for three reasons [3]:

  • Instruction Space - The amount of memory used to store the compiled version of instructions.
  • Environmental Stack - When a function calls another function the current variables are pushed to the system stack while the other function is executed.
  • Data Space - the amount of memory used to store variables and constants.

Much like Time Complexity, the Space complexity of an algorithm can also be represented in Big O notation.

References

[1] W. Kuo and M. J. Zuo, Optimal reliability modeling: principles and applications, John Wiley & Sons, 2003 , p. 62.

[2] https://www.geeksforgeeks.org/g-fact-86/

[3] https://www.studytonight.com/data-structures/space-complexity-of-algorithms

⚠️ **GitHub.com Fallback** ⚠️