Question
Lab: Recursion Objectives: To work with recursive algorithms. Create a Recursion class and provide required methods (using recursion) to support the following main method. public
Lab: Recursion Objectives:
To work with recursive algorithms.
Create a Recursion class and provide required methods (using recursion) to support the following main method.
public static void main(String[] args) { System.out.println("Factorial : " + Recursion.factorial(5)); System.out.println("Fibonnaci Value : " + Recursion.fibonnaciValue(7)); System.out.print("Fibonnaci Series : "); for (int i = 1; i <= 10; i++) System.out.print(Recursion.fibonnaciValue(i) + " "); System.out.println(); int[] a = { 5, 8, 4, 7, 9, 6, 11, 25, 13, 38 }; System.out.println("Max : " + Recursion.max(a, 0, a.length - 1)); System.out.println("Min : " + Recursion.min(a, 0, a.length - 1)); System.out.println("Sum : " + Recursion.sum(a, 0, a.length - 1)); }
Note: No changes to be made in the provided main method.
Sample Output
Factorial : 120
Fibonnaci Value : 13
Fibonnaci Series : 1 1 2 3 5 8 13 21 34 55
Max : 38
Min : 4
Sum: 126
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started