Write the missing base case for function largest. Function largest should find the largest number in array numbers. When largest is first called, index will equal numbers.length-1.

Respuesta :

Answer:

public int largest(int[] numbers, int index) {

 if (index == 0)

   return numbers[0];

 return Math.max(numbers[index], largest(numbers, index-1));

}

Step-by-step explanation:

An image of the question is attached.  The missing base case is to check for when the index is equals to zero.

if (index == 0)

When index is zero, it return the only element that is present in the array which is numbers[0].

Ver imagen ibnahmadbello