Recursion termination: Difference between revisions

Content deleted Content added
Yobot (talk | contribs)
m C++: WP:CHECKWIKI errors fixed + general fixes using AWB (8961)
Ashleyleia (talk | contribs)
added wikilinks
Line 1:
{{dead end|date=February 2013}}
 
In computing, '''Recursion termination''' is when certain conditions are met and the [[recursive algorithm]] ceases calling itself and begins to return values.<ref>http://www.itl.nist.gov/div897/sqg/dads/HTML/recursiontrm.html</ref> This happens only if with every recursive call the recursive algorithm changes its state and moves towards the base case. Cases that satisfy the definition without being defined in terms of the definition itself are called base cases. They are small enough to solve directly.<ref>
{{cite book
| title = Recursion Lecture, Introduction to Computer Science pg. 3
Line 11 ⟶ 10:
 
===Fibonacci function===
The [[Fibonacci function]](fibonacci(n)), which takes [[integer]] n(n >= 0) as input, has three conditions
 
1. if n is 0, returns 0.<br>
Line 20 ⟶ 19:
 
===C++===
[[C++ (programming language)|C++]] Example:<ref>
{{cite book
| title = An Introduction to the Imperative Part of C++