The structure of a collection dictates which is the easiest way to
divide up the collection. An array can be divided into a front
and a back, a stack into a top and a remainder.
To add up the numbers on a stack:
- If the stack is empty, by convention the sum of no numbers is 0.
- If the stack is not empty, divide it into a Top and a Remainder.
- Top is a number: S1 = Top
- Remainder is a stack: add up its numbers; this is a
recursive call returning S2.
- Combine: S = S1 + S2 = Top + sum of numbers in Remainder.