← Tech dictionaryLearn it properlyDSA tutorials — free, with diagrams, quizzes and a certificate
Data structures & algorithms
What is Recursion?
Recursion is when a function solves a problem by calling itself on a smaller version of the same problem, until it reaches a base case that is answered directly. Every recursive function needs a base case, or it never stops.
Example
factorial(n) = n × factorial(n − 1), with factorial(0) = 1 as the base case.