diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2008-01-27 11:37:44 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@xenon.tklauser.home> | 2008-01-27 11:37:44 +0100 |
commit | 7e0f021a9aec35fd8e6725e87e3313b101d26f5e (patch) | |
tree | b1cacc4b24393f517aeb4610e9e1021f954307a8 /reference/C/TECHNIC/itter_rec.html |
Initial import (2.0.2-6)2.0.2-6
Diffstat (limited to 'reference/C/TECHNIC/itter_rec.html')
-rw-r--r-- | reference/C/TECHNIC/itter_rec.html | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/reference/C/TECHNIC/itter_rec.html b/reference/C/TECHNIC/itter_rec.html new file mode 100644 index 0000000..73998b0 --- /dev/null +++ b/reference/C/TECHNIC/itter_rec.html @@ -0,0 +1,49 @@ +<title>Iteration vs Recursion.</title> +<body bgcolor=#f5deb3> +<hr> +<center> +<h1>Iteration vs Recursion</h1> +</center> +</hr> + +Most problems that can be solved with iteration ( +<a href=../SYNTAX/for.html>for</a>, +<a href=../SYNTAX/while.html>while</a>, +<a href=../SYNTAX/do.html>do</a> +loops) can +also be solved with recursion. Pros and cons are: +<ul> +<li>Iteration code will be faster and will use less resources. +<li>Recursion normaly looks more like the original formula. +</ul> +Anyway up, as an example of both technics here is some code to give the +factorial of a number. +<a href=../EXAMPLES/fact1.c>Iteration</a>------ +<a href=../EXAMPLES/fact2.c>Recursion</a> +<hr> +<p> +<center> +<table border=2 width=80% bgcolor=ivory> +<tr align=center> +<td width=25%> +<a href="../cref.html" target="_top">Top</a> +</td><td width=25%> +<a href="../master_index.html" target="_top">Master Index</a> +</td><td width=25%> +<a href="../SYNTAX/keywords.html" target="_top">C Keywords</a> +</td><td width=25%> +<a href="../FUNCTIONS/funcref.htm" target="_top">Functions</a> +</td> +</tr> +</table> +</center> +<p> +<hr> +<address> Martin Leslie +<script language="JavaScript"> +<!-- // +document.write(document.lastModified); +// --> +</script> +</address> + |