Course Solutions Uncategorized (Solved) : Find Time Complexity Big Oh Code Define Max 10 Int Sum Int X Int N Int Odd Odd 1 Printf Od Q32681850 . . . .

(Solved) : Find Time Complexity Big Oh Code Define Max 10 Int Sum Int X Int N Int Odd Odd 1 Printf Od Q32681850 . . . .

 

How can I find time complexity (Big OH) in this code?

#define MAX 10

int sum(int x[],int n, int odd)

{

  

if(odd==-1)

{

printf(“odd = %d, even = %dn”, sum(x, n, 1), sum(x, n, 0));

return 0;

}

  

if(n%2!=odd)

return sum(x, n+1, odd);

  

if(n>=MAX)

return 0;

  

return x[n]+sum(x, n+1, odd);

}

int main(void)

{

int x[MAX]={0,1,2,3,4,5,6,7,8,9};

  

sum(x, 0, -1);

  

return 0;

}

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post