Memoization
Memoization
The program also computes and prints out the time taken in
determining this number. In this case (n=25), time taken was 10
milliseconds. Lets run this program for n > 25 and see how much time
it takes. For n=30 (17 ms), n=35 (105 ms), n=40 (1023 ms),
n=45(12083 ms), n=46 (17872 ms), n=48 (30889 ms). As you can
see, the time taken is increasing at an alarming rate because the
number of recursive calls are increasing at a very high rate with every
increase in the value of n.