Given the class Arithmetic with a recursive method my_method(). public class Arithmetic{ public int my_method( n ){ if(n==1){ return 4; } else{ return 2 + 3 * my_method(n-1) } } public static void...


Given the class Arithmetic with a recursive method my_method().


public class Arithmetic{


            public int my_method( n ){


                        if(n==1){


                                    return 4;


                        } else{


                                    return 2 + 3 * my_method(n-1)


                        }


            }



            public static void main(String[] args){


                        Arithmetic ari = new Arithmetic();


                        System.out.println( ari.my_method(4) );


            }


}



Question:



  1. Discuss  what will be printed on the output by walking through the execution of the recursive method my_method() if n is 5 in details.

  2. Explain two primitive operations used in my_method()

  3. Discuss the time complexity of the method my_method() in big-O



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here