Space Complexity
Space Complexity
Section titled “Space Complexity”Measures extra memory used by an algorithm.
function sum(arr) { let total = 0; for (let num of arr) { total += num; } return total;}Space: O(1)
Measures extra memory used by an algorithm.
function sum(arr) { let total = 0; for (let num of arr) { total += num; } return total;}Space: O(1)