Programming ConceptsLesson 9Free preview
Recursion
This lesson is part of Intro to Programming · All levels
Summary
This lesson describes recursion, a technique where a function calls itself to break down a problem into smaller cases. Each recursion must have a base case that stops the call, otherwise the program will stop due to stack overflow. Recursion is useful for problems like factorial, Fibonacci sequence, and data structure traversal.
Key points
- Recursion is a function that calls itself
- Base case stops recurrence and prevents endless calls
- Without a base case, the program has a stack overflow.
- Suitable for problems of division such as factorial and Fibonacci
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.