Q4. Write a java program which will implement the following recursive function: f(n) = 2* f(n-1) + 3 * f(n − 2) f(1) = f
Posted: Mon Jun 06, 2022 6:02 pm
Q4. Write a java program which will implement the following recursive function: f(n) = 2* f(n-1) + 3 * f(n − 2) f(1) = f(0) = 2 For example: f(2)= 2f (1) +3f(0) = 4 + 6 = 10 f(3) = 2f (2) +3f(1) = 20 + 6 = 26 f(4) = 2f (3) + 3f (2) = 52 + 30 = 82 (1 public static int fN(int n){ // write your code below