AI engineering glossary · Data structures algorithms
What is recursion?
Recursion: A technique in which a function solves a problem by calling itself on a smaller version of the same problem until it reaches a case simple enough to answer directly. It suits trees, nested data and divide and conquer.
Recursion: an example
factorial(4) = 4 * factorial(3), which continues down to factorial(1) = 1, then multiplies back up to give 24.
Related terms
More Data structures algorithms terms
- Red-black tree
- Reservoir sampling
- Segment tree
- Selection sort
- Separate chaining
- Shortest path
- Sliding window
- Sorting
Where you learn it
Recursion is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.