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
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
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
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!