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
Solesbee v. Balkcom (1950) was one of two cases that challenged the constitutionality of capital punishment prior to 1968. What
Karo-lina-s [1.5K]

Answer:

Whether a governor is allowed to determine an inmates sanity where finding an inmate insane would prevent his or her execution

Explanation:

The Solesbee v. Balkcom (1950) was a case where a state in its policy was against the execution of convicts who goes insane after being convicted and sentenced. According to this case, under the Fourteenth Amendment, such is not considered denial of due process if the governor is vested with the power to determine if a convict is insane after sentence or not, and if he is actually insane, a governor should be the one to say if the convict is to put in an insane asylum.

4 0
3 years ago
What is a text based language that can be used to build all kinds of things ????
Makovka662 [10]

Answer:

It's easier to define text-based programming languages. These are languages that are typed using a keyboard and stored as text files. A graphical or visual language typically uses drag and drop rather than typing. It may use icons or textual labels on blocks or elements.

4 0
3 years ago
Basically, if for every row, the absolute value of the entry along the main diagonal is larger than the sum of the absolute valu
Elza [17]

Answer:

Check the explanation

Explanation:

MATLAB code:

%----------------------

function result = dominant(A)

% matrix dimensions

d = size(A);

% for loop over rows

for i = 1:d

% sum of row elements except diagonal element

sum_row =0;

% for loop over columns

for j = 1:d

% adding each elements to sum variable

sum_row = sum_row+ abs(A(i,j));

end

%subratcting diagonal element

sum_row = sum_row-abs(A(i,i));

%checking dominant condition

% failed once means matrix is not diagonal dominant

if abs(A(i,i))< sum_row

result = 'false';

return;

end

end

% dominant condition not failed

result = 'true';

end

% matrix A

A = [ 3 -2 1; 1 -3 2; 1 2 6]

% result

result = dominant(A)

% matrix A

A = [ -2 1 2; 1 3 2; 1 -2 0]

% result

result = dominant(A)

%----------------------

Kindly check the attached output image below.

3 0
3 years ago
Match the terms with their definitions.
Sever21 [200]
Phishing is 2
clickjack is 1
malware is 3
single signon is 4

Internet safety tip: Single Sign-On is unsafe. The others are made by hackers with no life and no heart.

5 0
4 years ago
Read 2 more answers
When you use a while loop to compute the product of several values, you should initialize the variables holding the product to _
Allushta [10]

Answer:

b.1

Explanation:

When we are using while loop to compute the product of several values we need to initialize the value holding the product to 1 because when we multiply something with 1 it will give the same number.

If we initialize it with 0 the product will come out to be 0 because  anything multiplied by 0 is 0.

we cannot initialize it with NULL because it is not a pointer.

We need to initialize the number since it contains garbage values so it will give product with that value.

3 0
3 years ago
Other questions:
  • Who usually signs a collection letter?
    15·2 answers
  • list the network characteristics of the wireless network(s) in the decode -- SSIDs, channels used, AP names, presence of Bluetoo
    6·1 answer
  • Write a program that opens a text le called quiz.txt for reading. This le contains a single line with a student's rst name then
    15·1 answer
  • a ____ consists of wires connecting the cpu and other parts of the computer. The _____ transfers data between CPU and memory uni
    6·1 answer
  • Where can I easily find an easy app or program to use for making/editing videos?
    13·1 answer
  • Design two subclasses of Employee…SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An ho
    12·1 answer
  • Which function will show 6 as the answer in the following formula<br><br> =_ (36)
    10·1 answer
  • Write a paragraph discussing privacy issues on the internet<br> and their impact on human lives.
    9·1 answer
  • Philip took pictures with his smartphone and save them into his computer unless you delete the photos from the computer they wil
    12·1 answer
  • Write a program, using case statements, that mimics a calculator. The program should take as input two integers and the operatio
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!