Question: Write a recursive program to return the maximum number from an array of unsorted numbers. [5 pts] You cannot use any pre-defined library methods, such
Write a recursive program to return the maximum number from an array of unsorted numbers. [5 pts]
You cannot use any pre-defined library methods, such as sort. Iterative solution will not get any credit.
Use the following method signature:
public int getMax(int[] nums){
}
Answer the following questions:
(a) Based on your code, what type of recursion did you use ? [1 pt]
(b) What is the time complexity of your code ? You need to provide explanation or calculation. [2 pts]
(c) What is the space complexity of your code? Provide justification. [2 pts]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
