Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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