From charlesreid1

Revision as of 07:43, 8 March 2017 by Admin (talk | contribs) (Created page with "Recursion is a programming technique in which a function calls itself in the process of solving the problem. Recursion is good for problem-solving techniques that involve a la...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Recursion is a programming technique in which a function calls itself in the process of solving the problem. Recursion is good for problem-solving techniques that involve a large number of repetitive tasks, and always consist of a base case and a recursive case. For example, the factorial function in mathematics, $ n! $, is defined as the product of all integers smaller than n:

$ n! = n \times (n-1) \times (n-2) \times \dots \times 3 \times 2 \times 1 $

So 3! = 3 x 2 x 1 = 6, and 5! = 5 x 4 x 3 x 2 x 1 = 120.