Category:Recursion: Difference between revisions

Content added Content deleted
m (Spelling/grammar)
(tail recursion)
Line 10: Line 10:
More than one end condition is allowed. More than one recursion condition is allowed.
More than one end condition is allowed. More than one recursion condition is allowed.


Many recursion problems can be solved with an iterative method (i.e. using a [[Loop Structures|loop]] of some sort). The factorial example is best done with a loop. If loop structures are not available (or not allowed), recursion is a good way to go.
Many recursion problems can be solved with an iterative method (i.e. using a [[Loop Structures|loop]] of some sort). The factorial example is best done with a loop. If loop structures are not available (or not allowed), recursion is a good way to go. Many languages are designed to favor recursion over explicit looping, using ''tail-recursion optimization'' to convert recursive calls into loop structures. [[Scheme]] is a notable example.


Below is a list of examples of recursion in computing.
Below is a list of examples of recursion in computing.