Recursion Fundamentals
Recursion from scratch. You'll learn the two parts of every recursive function and trace execution step by step.
Lessons
1. Intro
Why recursion matters
2. Core Concept
Self-calling functions
3. Vocabulary - Base Case
Stopping condition
4. Vocabulary - Recursive Case
Breaking down problems
5. Factorial - Problem Statement
Classic first recursion
6. Quiz: Base Case
Test your understanding
7. Factorial - Base Case
What's the simplest?
8. Factorial - Recursive Formula
Breaking it down
9. Factorial - Implementation
Writing the code
10. Factorial - Walkthrough
Tracing factorial(4)
11. Visualization - Call Stack
How calls stack up
12. Quiz: Call Stack
Testing stack understanding
13. Lessons from Factorial
summary
14. Sum of Digits - Problem Statement
New application
15. Quiz: Recursive Structure
Test your understanding
16. Sum of Digits - Base Case
Single digit
17. Sum of Digits - Recursive Formula
Last digit + rest
18. Sum of Digits - Implementation
Complete solution
19. Sum of Digits - Walkthrough
Tracing the calls
20. GCD - Problem Statement
Greatest Common Divisor
21. Quiz: GCD
Knowledge check
22. GCD - The Key Observation
Why modulo works
23. GCD - Base Case
When to stop
24. GCD - Recursive Formula
The Euclidean algorithm
25. GCD - Implementation
Three lines of code
26. GCD - Walkthrough
Tracing Euclid's algorithm
27. Challenge: Trace GCD
Manual recursion exercise
28. Power Function - Problem Statement
Computing x^n
29. Quiz: Power Function
Knowledge check
30. Power Function - Naive Recursion
The slow way
31. Power Function - The Optimization
Halving the problem
32. Power Function - Base Cases
When to stop
33. Power Function - Implementation
The efficient code
34. Power Function - Walkthrough
Tracing fast exponentiation
35. Quiz: Optimized Power
Testing power optimization
36. Lessons from Recursion
summary
37. Pattern - Recursive Decomposition
The general approach
38. Common Recursion Mistakes
Pitfalls to avoid
39. Recursion vs Iteration
When to use each
40. Quiz: Recursion vs Iteration
When to use which
41. What's Next
Preview of memoization
42. Section Recap
What we learned
Practice Problems
The exponential to linear speedup that demonstrates why memoization exists - bridges to DP
Simple string recursion that teaches substring finding with base case identification
Digit manipulation through recursion teaches extracting and checking digits one at a time
Shows how to handle exponentiation recursively with tricky edge cases like negative exponents
Forces you to find patterns in recursive structures using binary position thinking
Good example for understanding recursive funtions
Problems like factorial is naturally recursive.
Another Application of Recursion(Recursion in Digits)
Recursion in Mathematical Problems
Perfect for learning power function recursion with bit manipulation