The Recursion Reflex
Today’s one move: predict outputs before answers exist
Add the numbers from 1 to 5. Go on, in your head: 1 + 2 + 3 + 4 + 5. You got 15, and it took a few seconds.
Before anything is explained — commit: sum_to(4) = ?
Now imagine n = 10,000. You could still do it — but you'd be doing the same tiny operation, over and over, ten thousand times. Computers are good at that part. The interesting question is different:
The real question
How would you DESCRIBE the task so that the description itself is short — no matter how big n gets? Not the answer. The shape of the answer.
In this lesson you'll invent a way of describing 'sum from 1 to n' that is two lines long, works for any n, and is the single most important idea behind every tree algorithm you will ever write. Nobody will tell you the trick. You'll build it.