rite 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. example: largest({2, 4, 8}, 2) -> 8 public int largest(int[] numbers, int index) { if <> return numbers[0]; return Math.max(numbers[index], largest(numbers, index-1)); }
rite 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. example: largest({2, 4, 8}, 2) -> 8 public int largest(int[] numbers, int index) { if <> return numbers[0]; return Math.max(numbers[index], largest(numbers, index-1)); }
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
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.
example: largest({2, 4, 8}, 2) -> 8
public int largest(int[] numbers, int index) {
if <<Missing base case>>
return numbers[0];
return Math.max(numbers[index], largest(numbers, index-1));
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps