public class Main { static int findPosSum(int A[], int N) { if (N 0) return (findPosSum(A, N XXXXXXXXXXA[N - 1]); else return findPosSum(A, N - 1); } } public static void main(String[] args) { int...


 public class Main {


    static int findPosSum(int A[], int N)
 {
  if (N <=>
   return 0;

   {
      if(A[N-1]>0)
      return (findPosSum(A, N - 1) + A[N - 1]);
      else
      return findPosSum(A, N - 1);
     }


 }
 public static void main(String[] args)
 {
   int demo[] = { 11, -22, 33, -4, 25,12 };
  System.out.println(findPosSum(demo, demo.length));
 }
}


Consider the recursive function you wrote in the previous problem.





    1. Suppose the initial call to the function has an array of N elements, how many recursive calls will be made?

    2. How many statements are executed in each call?

    3. What is the total number of statements executed for all recursive calls?

    4. What is the big O for this function?





Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here