Recursion is a programming technique where a function calls itself in order to solve a problem. Each recursive call works on a smaller instance of the problem, gradually reducing the complexity until it reaches a base case, which stops the recursion.
- Big O Notation
By the end of this module, learners will be able to:
- Identify cases for recursion.
- Write the base case and recursive cases of a recursive function.
- Identify functions that use recursion and explain why it’s used.
There are two components to this module:
- Lesson: Recursion
- Exercise: Writing Recursive Functions
- Exercise Solution: Recursion
1.5 hours total:
- 0.5 hour - Recursion Lesson
- 1 hour - Writing Recursive Functions Exercise
- How recursion comes up in job interviews: An article discussing how recursion is often featured in job interviews.
- More thoughts on recursion in job interviews: Additional insights on the use of recursion in job interviews.
- Sketching out a recursive function: A video tutorial on drawing recursive functions.
- Just for fun: The recursion subreddit.
Find a 👾 bug 👾 or have suggestions? Let us know!
