summaryrefslogtreecommitdiff
path: root/reference/C/TECHNIC/itter_rec.html
diff options
context:
space:
mode:
Diffstat (limited to 'reference/C/TECHNIC/itter_rec.html')
-rw-r--r--reference/C/TECHNIC/itter_rec.html49
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>
+