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
One concern some users have about storing data or accessing applications in the cloud is .
andriy [413]

Answer:

Explanation:

Security is the primary concern about cloud computing. This is the main for many IT departments to refrain from using cloud computing. Some things that put the security of cloud computing to be concerned are: Theft or loss of intellectual property.

3 0
3 years ago
Which is a safe Internet behavior?
Westkost [7]
Don’t give out personal information
7 0
3 years ago
The OnStar system allows Select one: a. a vehicle owner to initiate a conversation with an OnStar representative. b. the vehicle
Rzqust [24]

Answer:  e) a, b, and c

Explanation: OnStar system is the secondary service that is provided by the General Motor Corporation , who is the parent company of this system.The services like in-vehicle protection, diagnosing issues from distance emergency services, communication services based on subscriptions, turn by turn navigation etc.

Conversation started with OnStar member by vehicle owner is communication service in hands -free way, vehicle sending message to OnStar member after mishap/accident is type of emergency services and OnStar member putting off the gas pedal without the permission of driver of the the vehicle is also a protect service .Thus, all the given options are correct.

6 0
3 years ago
Jaboooo helloooo are u there
Fed [463]
?????????????????????
8 0
3 years ago
Read 2 more answers
Which file extension indicates a Microsoft Excel document?
VikaD [51]
XLSX is the extension for an excel document.

3 0
3 years ago
Other questions:
  • Does group policy management matter without a server environment?
    7·1 answer
  • The java class library interface queue method tagg retrieves the entey at the front of a queue but themrows a NosuchElementExcep
    6·1 answer
  • What types of scientific claims should be verified
    5·1 answer
  • Which does the histogram resemble the most?
    10·1 answer
  • What is the purpose of system calls, and how do system calls relate to the OS and to the concept of dual-mode (kernel-mode and u
    14·1 answer
  • Explain how each of the five types of prewriting assist a writer in getting started. please make it short.
    15·1 answer
  • What is a good coding site
    10·1 answer
  • A protester seeking to make a political point by leveraging technology tools, often through system infiltration, defacement, or
    8·1 answer
  • What is the preferences of occupation in ones life?
    14·1 answer
  • Hi there! I just started my beginner computer science class and I was wondering if anyone wants to help with an assignment i'm h
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!