- 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 1 (24.85 KiB) Viewed 14 times
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
-
- Site Admin
- Posts: 899603
- 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