Content deleted Content added
Deleted the beginning paragraph as its text was already used farther in the article (and actually was a bad introduction to recursion) |
→Recursive programming: Justifying example of iteration |
||
Line 35:
Although the recursive factorial function is calculating the same value as the iterative function below, depending on language implementation, recursive function may consume additional memory for each call. I.e. factorial(20) may use ten times more memory than factorial(10). The [[Scheme programming language|Scheme]] language is especially efficient at recursion, but naive recursive implementations in earlier versions of [[C programming language|C]] were very notoriously wasteful. Nowadays, only the most performance-hungry software, such as video games, missile guidance systems and graphics card drivers, should worry about whether recursion will be slower than iterative <tt>for</tt> or <tt>while</tt> loops.
Recursive functions are often regarded as more elegant than alternative implementations and they are usually shorter and simpler.
'''function Factorial ( integer X )
|