Question: 1 import java.util.Arrays; 2 ? public class Labs{ //part a) // base case 1 return a[e]; 4 public static int maximum(intl] a)t if(a.length ## 1)
![base case 1 return a[e]; 4 public static int maximum(intl] a)t if(a.length](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f33162f30c2_92266f331625b518.jpg)
1 import java.util.Arrays; 2 ? public class Labs{ //part a) // base case 1 return a[e]; 4 public static int maximum(intl] a)t if(a.length ## 1) // base case 2 9 if (a.length2) if(a[a.length-1]a[a.length-2]) return ala.length-2]; return a[a.length-1]; // comparing the last 2 and putting the greater number in last but one in the array a[a.length-2]a[a.length-1]; return maximum(Arrays.copyOfRange(a, , a.length-1)); // part b) int resulta[ej; else 6' ?f(a[a.length-1] > a[a.length-2]){ 2 public static int minimum (int[] a)f 4 for (int i-1; i
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
