3.7 Factorial Factorial is a classic example of recursive procedure. A recursive function may be used to calculate the factorial of a natural number. The general form of factorial(n) is 1*2*..*n, but recall that n must be at least zero, and factorial(0) is 1. Time Complexity SpaceComplexity Pseudo Code
|
© The University of Hong Kong Algorithms Library - hkual@cs.hku.hk |