This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision | ||

factorial [2012/10/04 21:59] 127.0.0.1 external edit |
factorial [2015/02/02 08:28] (current) |
||
---|---|---|---|

Line 1: | Line 1: | ||

====== Factorial ====== | ====== Factorial ====== | ||

+ | If you want to calculate a factorial use the iterative algorithm. The recursive algorithm is included because factorial highlights the differences between iterating and recursing nicely. | ||

+ | |||

+ | ===== Iterative ===== | ||

+ | $$n!=\prod_{k=1}^n k \!$$ | ||

+ | |||

+ | [algorithm Factorial (iterative)] | ||

+ | |||

===== Recursive ===== | ===== Recursive ===== | ||

$$ n! = \begin{cases} | $$ n! = \begin{cases} | ||

Line 8: | Line 15: | ||

[algorithm Factorial (recursive)] | [algorithm Factorial (recursive)] | ||

- | |||

- | ===== Iterative ===== | ||

- | $$n!=\prod_{k=1}^n k \!$$ | ||

- | |||

- | [algorithm Factorial (iterative)] |

factorial.1349413174.txt.gz ยท Last modified: 2015/02/02 08:24 (external edit)