Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions