Answered step by step
Verified Expert Solution
Question
1 Approved Answer
25. Consider the following recursive function then answer the questions [2 points] 1. float recmax (int 1, int u) 3456789 if (1 > u)
25. Consider the following recursive function then answer the questions [2 points] 1. float recmax (int 1, int u) 3456789 if (1 > u) /* zero elements */ return 0; u) /* one element */ return max (0, A[1]); (1+) / 2; /* find max crossing to left */ 1max= sum wwwwww 0; for ( m; 1; i--) { sum + A[i]; if (sum >lmax) wwwww 1max sum; wwwwww 2. 3. 4. if (1 5. 6. m 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. for (i = 17. 18. 19. 20. } 21. return max (max (recmax (1, m), 22. 23. recmax (m+1, u)), 1max +rmax); 24. } /* find max crossing to right */ rmax wwwwwww sum = 0; m+1; u; i++) { sum + A[i]; if (sum rmax) rmax sum; wwwwww a) What does the function return for the array of values [-2, 1, -3, 4, -1, 2, 1, -5, 4]? Justify your answer. b) Write a recurrence relation T (n) that characterizes the running time of the recmax function, justify your answer by showing the cost of the recursion base, divide, conquer, and combine. c) Find an appropriate asymptotic bound solution to the recurrence T(n)? Focus
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