Space Complexity
Task: Watch two algorithms read the same array
What you are watching
Two algorithms reading the same array of eight numbers, step for step. The first keeps a running total in a single variable that is overwritten on every step, so however long the input gets it never holds more than one value. The second builds a new list, appending the square of each number, so it ends up holding one value for every element of the input. Both take the same number of steps and both look at every element, but one finishes holding a single box and the other finishes holding eight, which is the difference between O(1) and O(n) auxiliary space.