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
strojnjashka [21]
3 years ago
11

2. a. Write pseudocode for a divide-and-conquer algorithm for finding valuesof both the largest and smallest elements in an arra

y of n numbers.b. Set up and solve (for n = 2k) a recurrence relation for the number of keycomparisons made by your algorithm.c. How does this algorithm compare with the brute-force algorithm for thisproblem?
Computers and Technology
1 answer:
Lisa [10]3 years ago
6 0

The pseudocode :

Pair MaxiMini(array, sizeof_array)

if sizeof_array = 1

return element as both maximum and minimum

else if sizeof_array = 2

do one comparison to find the maximum and minimum

return that pair

else

# sizeof_array > 2

recursion for maximum and minimum of the left half

recursion for maximum and minimum of the right half

one comparison determines the true max of the two elements

one comparison determines the true min of the two elements

return the pair of maximum and minimum

You might be interested in
Alonzo collects bugs. He has created a fascinating display of large insects. Collecting bugs is a(n) _____ to Alonzo.
-Dominant- [34]
The answer is hobby. He does it because he enjoys it. There is no information of him being told or paid to collect bugs, so it is a hobby.
3 0
3 years ago
Read 2 more answers
What is the difference between ARM and INTEL Chip?
tia_tia [17]
With the ever-present rumor of ARM MacBooks<span> gaining renewed energy, it’s time to get an understanding of the technical differences between ARM processors and the more common x86 processors made by </span>Intel<span> and AMD.</span>
8 0
3 years ago
Kevin is a DJ and has a passion for creating and modifying audio tracks. Which application software facilitates him in his passi
stiv31 [10]
B. Multimedia software
5 0
3 years ago
Which of these would be directly related to the science of ecology?
GuDViN [60]
I believe the correct answer from the choices listed above is option C. It would be uncovering the genetic makeup of the eastern cottontail rabbit that will have a direct relation <span>to the science of ecology. Hope this answers the question. Have a nice day.</span>
4 0
3 years ago
Read 2 more answers
The value of a default argument must be a(n) _________.
kvv77 [185]

Answer:

Constant

Explanation:

A default argument is a value provided in a function declaration that the compiler automatically assigns if the function caller does not provide a default value for the argument.

The value of a default argument must be constant.

The default value parameter must be a  constant for compiling. Compiler does not accept dynamically calculated value against optional parameter. The reason behind this it is not certain that the dynamic value you provide would offer some valid value.

<u>Example:</u>

#include<iostream>  

using namespace std;  

/*A function with default arguments, it can be called upto 4 arguments*/

int sumnum(int x, int y, int z=0, int w=0)  

{  

return (x + y + z + w);  

}  

int main()  //driver function

{  

cout << sumnum(10, 15) << endl;  

cout << sumnum(10, 15, 25) << endl;  

cout << sumnum(10, 15, 25, 30) << endl;  

return 0;  

}

<u>Output</u>

<u>25 </u>

<u>50 </u>

<u>80</u>

3 0
3 years ago
Other questions:
  • 6. Sandra did a survey to see how
    9·1 answer
  • What is an objective of state-sponsored attackers?
    11·1 answer
  • When compared to traditional desktop customers, why are mobile phone users much more likely to book a room or airline reservatio
    12·1 answer
  • Why does dew form on grass overnight
    7·1 answer
  • In the digital age we have less time to absorb and make sense of new information
    12·2 answers
  • You complete your database, and the company begins using it. Shortly afterwards, two GearUp buyers, Cora and Owen, work together
    9·1 answer
  • What is the working principle of computer?​
    10·1 answer
  • What is a cookie? *
    9·2 answers
  • Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a/b, in which a and b a
    11·1 answer
  • Which game title went on to become the highest selling unbundled cartridge game?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!