One-page version suitable for printing.
Consider the following recursive class method.
Suppose a program called printStuff(4). What would the computer print?public static void printStuff(int n) { if(n > 0) { printStuff(n - 1); IO.println(n); printStuff(n - 2); } }
Consider the following recursive class method.
public static int f(int n) { if(n <= 1) { return 1; } else { return f(n - 1) + f(n / 2); } }