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
1) If a robot has a 3 bit instruction set and needs 20 instructions to reach its destination, how many bits of memory are requir
mariarad [96]

Answer:

Explanat500,000ion:

8 0
2 years ago
Google is the most popular:
Dvinal [7]
Google is the most popular C) Search engine.

  Explore for erudition regarding an individual or anything at the Internet by the usage of the search engine  ---> Google.

7 0
3 years ago
Read 2 more answers
Makes it possible to distribute both power and data using ethernet cabling. select one:
Nimfa-mama [501]
It would be: 

b.) poe cable 

message me on my profile if you need any more help! :) 
6 0
3 years ago
Write a class named Add that has the following data members, constructor, and methods:
taurus [48]

Answer:

A class is like a blueprint of object.

Explanation:

A class defines the kinds of data and the functionality their objects will have.

A class enables you to create your own custom types by grouping together variables of other types, methods and events.

In C#, we can create a class  using the class keyword.

Here's a sample program:

using System;

namespace ConsoleApplication

{

   public class Test

   {

       public static void Main()

       {

           Add a1 = new Add(70, 50);

           a1.AddNumbers();                    

           Console.ReadLine();

       }      

   }

     class Add

   {

       private int row;

       private int column;

       public Add(int r, int c)

       {

           row = r;

           column = c;

       }

       public void AddNumbers()

       {

           Console.WriteLine(row+column);

       }

   }

}

output: 120

Explanation of the program:

I have created a class named Add. Within a class, row and column are two fields and AddNumbers() is a method. We also have constructor to initialize row and column.

In main method, If I need to invoke members of the class, I must create  an instance of the class. We can create any number of instances using the single class.IN our program, a1 is the reference variable using which we can invoke members of the class. I invoked function in the class and passed arguments to the constructor while creating an instance.

Those values are assigned to method variables and it operated the addition. Thus the output is 120.

7 0
3 years ago
How many base cases are in the functionabove?
baherus [9]

Answer:

The answer is (b). 1.

Explanation:

In the code there is only 1 base case .

the base case is as following:-

if(n==0)

return 0;

this is the base case.

Base case is the most important statement in the function that uses recursion because without base case the recursion calls will keep on going and we will get a run time error.

5 0
2 years ago
Other questions:
  • What would happen if a pc that contains a power supply that does not automatically adjust for input voltage is set to 230 volts
    13·1 answer
  • Write a program "addnumbers.c" where it takes as many arguments as the user includes as command line arguments and calculates th
    11·1 answer
  • How do you change your age on Brainly?
    10·1 answer
  • The term phreaker is now commonly associated with an individual who cracks or removes software protection that is designed to pr
    13·2 answers
  • In the program below, which two variables have the same scope?
    9·2 answers
  • Which important aspect of the Roman Empire did the barbarians destroy?
    14·2 answers
  • PLEASE ANSWER ASAP!! Where is the findmore answers page I NEEDDD the bsdge
    7·1 answer
  • Select the correct technical term for each definition by using the drop-down menus.
    13·1 answer
  • What mathematical equation was created by a founder of intel?.
    11·1 answer
  • Is each of the following method identifiers (a) legal and conventional, (b) legal but unconventional, or (C) illegal?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!