Recursion: Difference between revisions

Content deleted Content added
fix the previous edit
Formal definitions: remove circularity
Line 12:
==Formal definitions==
[[File:Serpiente alquimica.jpg|thumb|[[Ouroboros]], an ancient symbol depicting a serpent or dragon eating its own tail]]
In mathematics and computer science, a class of objects or methods exhibits recursive (i.e. self-referential) behavior when it can be defined by two properties:
* {{anchor|base case}}A simple ''base case'' (or cases) — a terminating scenario that does not use recursionself-reference to produce an answer
* {{anchor|recursive step}}A ''recursive step'' — a set of rules that reduces all successive cases toward the base case by possibly invoking (referring to) the definition itself.
 
For example, the following is a recursive definition of a person's ''ancestor''. One's ancestor is either: