Search code examples
big-otime-complexityspace-complexity

Does Big O notation also represent space complexity?


Big O notation represents how long a method takes to run as input gets larger.

Does it (the formula) also represent space complexity?


Solution

  • Yes. Big-O notation is used to represent Space Complexity. Big-O notation in Space complexity is similar to that of Time complexity. It represents the "maximum amount of space used by the algorithm at anytime".