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
kumpel [21]
3 years ago
12

give a recursive algorithm for finding the maximum of a finite set of integers, making use of the fact that the maximum of n int

egers is the larger of the last integer in the list and the maximum of the first n-1 integers in the list
Mathematics
1 answer:
Karolina [17]3 years ago
7 0

Answer:

Recursive algorithms call itself with simpler or smaller input values. They can be used to solve large problems by using the solutions to minor parts of the problem, these minor problems are then further broken down to solvable cases.

Given the input as a sequence;

max(z_{1}, z_{2}, ... z_{k}: integers)

if k=1 return z_{1}

else

          c=max(z_{1}, z_{2},...z_{k-1})

          if c > z_{1} return c

          else return z_{1}

You might be interested in
Please help solve for X
Alexxx [7]
The answer to this is
x=8
3 0
2 years ago
Suppose two dice are tossed and the numbers on the upper faces are observed. Let S denote the set of all possible pairs that can
Thepotemich [5.8K]

Answer:

▪A = {(1,2) (1,4) (1,6) (2,2) (2,4) (2,6) (3,2) (3,4) (3,6) (4,2) (4,4) (4,6) (5,2) (5,4) (5,6) (6,2) (6,4)(6,6)}

▪C bar = {(2,2) (2,4) (2,6) (4,2) (4,4) (4,6) (6,2) (6,4) (6,6)}

▪A∩B = {(2,2) (2,4) (2,6) (4,2) (4,4) (4,6) (6,2) (6,4) (6,6)}

▪A∩B bar = {(1,2) (1,4) (1,6) (3,2) (3,4) (3,6) (5,2) (5,4) (5,6)}

▪A bar∪B = {(1,1) (1,3) (1,5) (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) (3,1) (3,3) (3,5) (4,1) (4,2) (4,3) (4,4) (4,5) (4,6) (5,1) (5,3) (5,5) (6,1) (6,2) (6,3) (6,4) (6,5) (6,6)}

▪A bar∩C = {(1,1) (1,3) (1,5) (2,1) (2,3) (2,5) (3,1) (3,3) (3,5) (4,1) (4,3) (4,5) (5,1) (5,3) (5,5) (6,1) (6,3) (6,5)}

Step-by-step explanation:

S = {(1,1) (1,2) (1,3) (1,4) (1,5) (1,6) (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) (4,1) (4,2) (4,3) (4,4) (4,5) (4,6) (5,1) (5,2) (5,3) (5,4) (5,5) (5,6) (6,1) (6,2) (6,3) (6,4) (6,5) (6,6)}

A = {(1,2) (1,4) (1,6) (2,2) (2,4) (2,6) (3,2) (3,4) (3,6) (4,2) (4,4) (4,6) (5,2) (5,4) (5,6) (6,2) (6,4)(6,6)} (second die is even)

B = {(1,1) (1,3) (1,5) (2,2) (2,4) (2,6) (3,1) (3,3) (3,5) (4,2) (4,4) (4,6) (5,1) (5,3) (5,5) (6,2) (6,4) (6,6)} (sum of the two numbers is even)

C = {(1,1) (1,2) (1,3) (1,4) (1,5) (1,6) (2,1) (2,3) (2,5) (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) (4,1) (4,3) (4,5) (5,1) (5,2) (5,3) (5,4) (5,5) (5,6) (6,1) (6,3) (6,5)} (at least one in the pair is odd i.e one of the pair is odd or both are odd)

A bar = {(1,1) (1,3) (1,5) (2,1) (2,3) (2,5) (3,1) (3,3) (3,5) (4,1) (4,3) (4,5) (5,1) (5,3) (5,5) (6,1) (6,3) (6,5)} (the pairs that are not in A)

B bar = {(1,2) (1,4) (1,6) (2,1) (2,3) (2,5) (3,2) (3,4) (3,6) (4,1) (4,3) (4,5) (5,2) (5,4) (5,6) (6,1) (6,3) (6,5)} (the pairs that are not in B)

C bar = {(2,2) (2,4) (2,6) (4,2) (4,4) (4,6) (6,2) (6,4) (6,6)} (the pairs that are not in C)

▪A = {(1,2) (1,4) (1,6) (2,2) (2,4) (2,6) (3,2) (3,4) (3,6) (4,2) (4,4) (4,6) (5,2) (5,4) (5,6) (6,2) (6,4)(6,6)}

▪C bar = {(2,2) (2,4) (2,6) (4,2) (4,4) (4,6) (6,2) (6,4) (6,6)}

▪A∩B = {(2,2) (2,4) (2,6) (4,2) (4,4) (4,6) (6,2) (6,4) (6,6)} (intersection: the pairs that are common to both A and B)

▪A∩B bar = {(1,2) (1,4) (1,6) (3,2) (3,4) (3,6) (5,2) (5,4) (5,6)} (intersection: the pairs that are common to both A and B bar)

▪A bar∪B = {(1,1) (1,3) (1,5) (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) (3,1) (3,3) (3,5) (4,1) (4,2) (4,3) (4,4) (4,5) (4,6) (5,1) (5,3) (5,5) (6,1) (6,2) (6,3) (6,4) (6,5) (6,6)} (union: all the pairs in A bar and B )

▪A bar∩C = {(1,1) (1,3) (1,5) (2,1) (2,3) (2,5) (3,1) (3,3) (3,5) (4,1) (4,3) (4,5) (5,1) (5,3) (5,5) (6,1) (6,3) (6,5)} (intersection: the pairs that are common to both A bar and C)

6 0
3 years ago
Which is equivalent to 80 1/4x
vichka [17]

Answer:

20x

Step-by-step explanation:

\frac{80}{4}=\frac{20}{1}=20

3 0
2 years ago
Read 2 more answers
Hans wants to earn more than $51 trimming trees. He charges $7 per hour and pays $5 in equipment fees. What are the possible num
Flura [38]

Answer:

h ≤ 8

Step-by-step explanation:

Hans charges $7 per hour and pays $5 in equipment fees.

$5 is fixed in this case. Let the possible number of hours be h.

According to question,

Atleast means less than equal to. So,

7h-5≤51

Add 5 to both sides.

7h+5-5 ≤ 51+5

7h ≤ 56

h ≤ 8

So, the number of hours be less than equal to 8.

7 0
2 years ago
How many times does 15 goes into 2
Whitepunk [10]

Answer:

7

Step-by-step explanation:

2,4,6,8,10,12,14 that is howni got my answer

4 0
3 years ago
Read 2 more answers
Other questions:
  • Which expression is equivalent to 3*5*5*5*5*5*5
    8·2 answers
  • Wes lives in Colorado, which has a state income tax
    8·1 answer
  • Write down the first even multiple of 7.
    12·1 answer
  • Which is the line shown in the figure ? <br> line XY <br> line XZ<br> line WX<br> line WZ
    10·1 answer
  • Question 6<br> The point (-2, 1); is on the graph of which of these functions?
    11·1 answer
  • What is an equation of the line that passes through the point (4, -6) and has a slope of -3
    10·1 answer
  • I don’t get this please solve it please
    13·2 answers
  • 2+2! ANSWER FAST OR MY TACHER WILL KILL ME
    12·1 answer
  • Question 2 of 5
    11·1 answer
  • Solve the following variation problem.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!