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
You listened to a song on your computer. did you use hardware or software? explain.
scZoUnD [109]
Software, unless you planned on permanently downloading the Music Album or Song to your computer's Hard Drive. i.e, you would use whatever Music or Media player you have installed on your computer, and that simply counts as Software. 
4 0
3 years ago
Which type of operation writes the file system structure to the disk?
n200080 [17]
Formatting<span> writes the file system structure to the disk.</span>
8 0
3 years ago
Indicate whether the following statements are true or false:
postnew [5]

Answer:C

Explanation:I got it correct on the computer

7 0
3 years ago
Read 2 more answers
Which statement best describes one reason why assembly language is easier
viktelen [127]

Answer:

machine language uses binary code and assembly language uses mnemonic codes to write a program.

Explanation:

In a nutshell, machine language uses binary code, which is almost impossible for humans to decipher, whereas assembly language uses mnemonic codes to write a program. Mnemonic codes make it simpler for humans to understand or remember something, and so make the language a bit easier for humans to use than machine code.

6 0
2 years ago
The appropriate length for an e-mail is about half the amount of text that will fit on an 8 1/2' by 11' page.
lys-0071 [83]

Wrong..............................................

7 0
3 years ago
Read 2 more answers
Other questions:
  • 11. You should type _
    6·2 answers
  • Write a brief one parapragh summary describing the financial reality of the American family.
    10·1 answer
  • Direct Mapped Cache. Memory is byte addressable. Fill in the missing fields based upon the properties of a direct-mapped cache.
    6·1 answer
  • How should you set the OHMS ADJust control on a multitester of analog VOM, for resistance measurements?
    12·1 answer
  • What two devices in a computer should be considered "black boxes," and should never be opened due to risks involving charged cap
    13·1 answer
  • Use fuel with the _____________ rating recommended by your vehicle manufacturer. A ) Converter B) Emission C) Exhaust D) Octane
    9·2 answers
  • The terms Apps and Applications can be used interchangeably about software installed
    8·1 answer
  • Im lonellly whos down to date me
    7·2 answers
  • True or false a mirrorless camera has a pentaprism
    14·2 answers
  • What is a common indicator of a phishing attempt cyber awareness 2022
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!