Show (1) the stack trace and (2) the recursive tree. You can draw them by hand on paper and attach them a picture your answers in the word document.
Algorithm:
n=sizeof(array)
function find_max(array, n):
if(n==1):
return array[0];
else
return max(array[n-1], find_max(array, n-1));
The time complexity for this algorithm will be O(n). If you have any doubts, or if you want me to code the output, let me know in the comments and i will add that as well. If you have any doubts let me know.
Thank you :)
Get Answers For Free
Most questions answered within 1 hours.