Question: Given the following recursive method: public static int f(int num) { if(num < 2) return 1; else if(num % 2 == 0) return f(num /
Given the following recursive method: public static int f(int num) { if(num < 2) return 1; else if(num % 2 == 0) return f(num / 2); else return f(3 * num + 1); }
How many recursive calls are made by the following initial calls? System.out.println(f(7)); System.out.println(f(8)); System.out.println(f(15)); System.out.println(f(16));
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
