A repetitive algorithm uses recursion whenever the algorithm appears in the definition itself. Simplest example of a recursive definition is that for the factorial function; defined as
n! = {
1 if n = 0 base case
n* (n – 1) ! if n > 0 general case
No comments:
Post a Comment