
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

































/** = n!, for n >= 0 / static int fact( int n) { if (n = = 0) return 1; // { n > 0 } return nfact(n-1); }
n! = n·(n- 1 )!, n > 0 1
Execution of fact(4) fact(1) fact(4) fact(3) fact(0) fact(2)
/** For 0 <= k < cached.size(), cached[k] = fib(k) */ static ArrayList
This works because of definition of cached This appends v to cached, keeping cached’s definition true