This commit is contained in:
Miloslav Ciz 2024-06-29 19:04:58 +02:00
parent 681319f2f2
commit f5c9f4da18
39 changed files with 1862 additions and 1803 deletions

View file

@ -2,7 +2,7 @@
*See [recursion](recursion.md).*
Recursion (from Latin recursio, "running back") in general is a situation in which a [definition](definition.md) refers to itself; for example the definition of a human's ancestor as "the human's parents and the ancestors of his parents" ([fractals](fractal.md) are also very nice example of what a simple recursive definition can achieve). In [programming](programming.md) recursion has a meaning of a **[function](function.md) that calls itself**; this is the meaning we'll assume in this article, unless noted otherwise.
Recursion (from Latin recursio, "running back") in general is a situation in which a [definition](definition.md) refers to itself; for example the definition of a human's ancestor as "the human's parents and the ancestors of his parents" ([fractals](fractal.md) are also very nice example of what a simple recursive definition can achieve). In [programming](programming.md) recursion denotes a **[function](function.md) that calls itself**; this is the meaning we'll assume in this article unless noted otherwise.
We divide recursion to a **direct** and **indirect** one. In direct recursion the function calls itself directly, in indirect function *A* calls a function *B* which ends up (even possibly by calling some more functions) calling *A* again. Indirect recursion is tricky because it may appear by mistake and cause a [bug](bug.md) (which is nevertheless easily noticed as the program will mostly run out of memory and crash).