RECURSION, IN REAL LIFE
How long is the canteen queue?
You cannot see the end. Ask the person directly behind you:
“Including yourself, how many people are there from you to the end?”
← CANTEEN · FRONTStart with AlexEND OF QUEUE
Each count includes that student and everyone behind.
Ready
Start with Alex. Every student will count themselves and everyone behind them.
Total in the queue?
1
Same questionAsk the person behind; wait.
2
Stopping pointLast student: “Just me. One.”
3
Answer comes backAdd yourself: 1 + their answer.
Step 1