Recursion (computer science): Difference between revisions

Content deleted Content added
Line 136:
}
 
The Euclidean Algorithm function, following a similar structure, is also tail-recursive. On the other hand, the <code>Factorial</code> function used as an example in the previous section is ''not'' tail-recursive, because after it receives the result of the recursive call, it must multiply that result by <code>x</code> before returning to its caller. That kind of function is sometimes called ''augmenting recursive''.
 
The <code>Factorial</code> function can be turned into a tail-recursive function: