Question: Recursive Function Java Help- 1. Write the recursive definition of function f(n) = 3n - 2, for integer n>0 2. Write a RECURSIVE method to

Recursive Function Java Help-

1. Write the recursive definition of function f(n) = 3n - 2, for integer n>0 
2. Write a RECURSIVE method to implement the above recursive funtion you get from problem 1. Your method skeleton should be public static int functionF(int n) { ... if //handle base case ... else // handle recursive step ... } 

3. For the following recursive function, what is the result if 1) n = 6, 2) n = 66, and 3) n = 666 ?

 public int exercise (int n) { if (n < 0) return -1; else if (n < 10) return 1; else return 1+exercise(n/10); } Thank you! 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!