1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leno4ka [110]
3 years ago
10

java The maximum-valued element of an integer-valued array can be recursively calculated as follows: If the array has a single e

lement, that is its maximum (note that a zero-sized array has no maximum) Otherwise, compare the first element with the maximum of the rest of the array-- whichever is larger is the maximum value. Write an int method named max that accepts an integer array, and the number of elements in the array and returns the largest value in the array. Assume the array has at least one element.
Computers and Technology
1 answer:
adoni [48]3 years ago
7 0

Answer:

see explaination

Explanation:

MaxArray.java

public class MaxArray{

public static void main(String[] args) {

int a[] = {1,2,5,4,3};

int max = max (a, 5);

System.out.println("Max value is "+max);

}

public static int max (int a[],int size){

if (size > 0) {

return Math.max(a[size-1], max(a, size-1));

} else {

return a[0];

}

}

}

Output:

MaxArray

You might be interested in
ITS A VOTE I NEED HELP
Mandarinka [93]

Answer: A block-level element is any element that starts a new line.

4 0
2 years ago
A pseudo code that asks the user for their forename and their surname , and then outputs both, separated by a space to the user​
Mamont248 [21]

Answer:

Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool. The rules of Pseudocode are reasonably straightforward. All statements showing "dependency" are to be indented. These include while, do, for, if, switch.

5 0
2 years ago
The piece of hardware that contains the circuitry that processes the information coming in to the computer and tells the other h
Gemiola [76]

The answer is C. Central processing unit (or CPU).

The trick is in the name, central processing unit :)

3 0
3 years ago
When giving a presentation it is better to ___________
Romashka-Z-Leto [24]
<span>C) Always better to give your information and end on time.</span>
6 0
3 years ago
A soft news story and a feature story are the same thing.<br> O True<br> O False<br> HELLPP ASSAAAP
bogdanovich [222]
The answer would be False!
5 0
2 years ago
Read 2 more answers
Other questions:
  • Microsoft Xbox operating system provides Xbox programmers with a set of common standards to use to access controllers, the Kinec
    6·1 answer
  • A vertical curve means that any change in the Aggregate Price Level will have what result?
    15·1 answer
  • What’s bigger 4,000,000 KB or 2.8 GB
    5·2 answers
  • In two to three sentences, describe one advanced search strategy and how it is useful.
    13·1 answer
  • Which of these statements about tags is false?
    12·1 answer
  • You can insert video by clicking video drop-down menu on the ______ tab.
    15·1 answer
  • Characteristics of RAM​
    5·1 answer
  • I'm showing my friends brainly. Answer with anything so they can see how fast I can get answers.
    10·2 answers
  • Write the name of main ore of silver.Write any two application of sliver​
    14·1 answer
  • SINCE I CANT SEE IT KANG LOOK
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!