Recursion
A self-referential data structure or computation.
Related concepts: TypeReferenceFunctionCall
Closest Wikipedia entry: Recursion (computer science) — In computer science, recursion is a method of solving a computational problem where the solution depends on solutions to smaller instances of the same problem. Recursion solves such recursive problems by using functions that call themselves from within their own code. The approach can be applied to many types of problems, and recursion is one of the central ideas of computer science.
Misconceptions about Recursion14 documented Misconceptions
Check YourselfBaseCaseNotNeeded
Recursive computations do not necessarily need a base caseBaseCaseSelfRecursive
The base case of a structural recursion consists of a recursive self-callForEachTraversesRecursiveStructure
For-each loops know how to traverse any recursive data structureRecursiveActivationsShareFrame
Recursive calls of a method share a stack frameRecursiveCallSiteNoReturn
Tail-recursive call sites have no continuationRecursiveMethodImpliesRecursiveType
A class with a recursive method represents part of a recursive data structureRecursiveMethodNeedsIfElse
A recursive method needs to contain an if-else statementReferringToRecursiveStructureMakesRecursive
A class referring to a recursive data structure is (indirectly) part of that recursion as wellReturnUnwindsMultipleFrames
A return statement can unwind multiple call stack framesUseOfSelfTypeImpliesRecursiveType
If a class has a method that has a local variable, parameter, or return value with the class as its type, the class is a recursive typeVoidMethodNotRecursive
A method with void return type can't be recursive