
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!

Figure 10.2 from Hanley and Koffman (modified) int mystery(int m, int n) { int ans; if (n == 1) /* simple case / ans = m; else / recursive step */ ans = m + mystery(m, n-1); return (ans); } compute mystery(5, 4); Notice m stays the same. Recursion is on n, which is 4 in our example Make a table m n mystery(m,n)