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
Mariulka [41]
2 years ago
14

In this problem you will explore two algorithms for the problem of merging k sorted arrays, each containing n elements, into a s

ingle sorted array containing nk elements. The cost of merging an array of size a with an array of size b is a+b.
O The first algorithm merges two of the arrays, then merges in the third array, then merges in the fourth array, and so on.
1. We start by merging together two of the k arrays together, producing array M2. What is the cost of this merge?
2. We merge another of the k arrays with M2 from the previous question, producing M3. What is the cost of this merge?
O Now we'll consider a second algorithm. We are given k n-element arrays to merge. We recursively merge the first k/2 arrays, recursively merge the second k/2 arrays, and then merge the two results.
3. Imagine the recursion tree that results from this. We are sitting at the root of the tree. What is the cost of the merge done at the top of the tree?
4. What is the total cost of the two merges done at the second level of the tree?
Computers and Technology
1 answer:
AveGali [126]2 years ago
5 0

Answer:

70 ponts for me wHO

Explanation:

You might be interested in
Complete the AscendingAndDescending application so that it asks a user to enter three integers. Display them in ascending and de
Andreas93 [3]

Answer:

Following are the solution to the given question:

import java.util.Scanner;//import package

public class AscendingAndDescending//defining a class AscendingAndDescending  

{

   public static void main(String[] args) //main method

   {

       int n1,n2,n3,min,max,m;

       Scanner in = new Scanner(System.in);//creating Scanner class object

       System.out.print("Enter an integer: ");//print message

       n1 = in.nextInt();//input value

       System.out.print("And another: ");//print message

       n2 = in.nextInt();//input value

       System.out.print("And just one more: ");//print message

       n3 = in.nextInt();//input value

       min = n1; //use min variable that holds value

       max = n1; //use mix variable that holds value

       if (n2 > max) max = n2;//use if to compare value and hols value in max variable

       if (n3 > max) max = n3;//use if to compare value and hols value in max variable

       if (n2 < min) min = n2;//use if to compare value and hols value in min variable

       if (n3 < min) min = n3;//use if to compare value and hols value in min variable

       m = (n1 + n2 + n3) - (min + max);//defining m variable that arrange value

       System.out.println("Ascending: " + min + " " + m + " " + max);//print Ascending order value

       System.out.println("Descending: " + max + " " + m + " " + min);//print Descending order value

   }

}

Output:

Enter an integer: 8

And another: 9

And just one more: 7

Ascending: 7 8 9

Descending: 9 8 7

Explanation:

In this program inside the main method three integer variable "n1,n2, and n3" is declared that inputs value from the user end and also defines three variable "min, max, and m" that uses the conditional statement that checks inputs value and assigns value according to the ascending and descending order and prints its values.

5 0
3 years ago
In computer science, what is the name for a series of steps used to solve a problem?
liraira [26]

Answer:

Algorithm

Explanation:

It is the step by step procedure,which defines a set of instructions which is to be carried out by the computer

5 0
3 years ago
Write a function named dice_eval that accepts two parameters representing numeric dice values and returns a string describing th
Zigmanuir [339]

Following are the "dice_eval" method code into python language.

Program Explanation:

  • Defining a method "dice_eval" that takes two variables "d1,d2" in its parametes.
  • Inside the method, multiple conditional statements were used that adds the parameter values and calculates its value which can be defined as follows:
  • In the if block, it adds the parameters and uses or gate that check its value that is equal to 7 or 11. so, it will return a string message that is 'Winner!'.  
  • In the elif block, it adds the parameters and uses or gate that check its value that is equal to 2 or 3 or 12. so, it will return a string message that is ' C r aps ! '.
  • In the else block, it uses a return keyword that adds parameter value and prints a string value.
  • Outside the method "d1,d2" is declared that inputs the value from the user-end, and passes the value into the method, and prints its value.

Program:

def dice_eval(d1, d2):#defining a method dice_eval that takes two parameters

if (d1+d2)==7 or (d1+d2)==11:#defining if block that adds parameter value and use or operator to check its value

return 'Winner!'#return string value

elif (d1+d2)==2 or (d1+d2)==3 or (d1+d2)==12:#defining elif block that adds parameter value and use or operator to check its value

return 'C r aps!'#return string value

else:#defining else block

return 'Point is '+str(d1+d2)#return string value with adding parameter

d1=int(input())#defining d1 that input value

d2=int(input())#defining d2 that input value

print(dice_eval(d1,d2))#calling method and print its return value

Output:

Please find the attached file

Please find the complete code in the attached file.

Learn more:

brainly.com/question/15011927

4 0
2 years ago
Which type of data is is usually collected as numerical data that can be presented in a graph or chart?
Natali5045456 [20]

Answer:

Quantitative data

Explanation:

Quantitative data is information about quantities; that is, information that can be measured and written down with numbers. Some other aspects to consider about quantitative data: Focuses on numbers. Can be displayed through graphs, charts, tables, and maps.

8 0
2 years ago
How can you take a picture of work on here?????
Ronch [10]
If your on a computer then you can download a screenshot app if you dont already have one and all you do is simply screen shot your whole screen .and if it is on a tablet or phone there should be a screenshot button right there.
7 0
3 years ago
Other questions:
  • How do I answer a question on Brainly.com without an “oops” notification?
    7·2 answers
  • Jessica has a balance of $2,200 on her credit card with an 18% interest rate. Her credit card company doesn’t require a minimum
    15·1 answer
  • An app where you spin a wheel for coins and exchange for giftcards
    6·1 answer
  • When users talk about font size,
    10·2 answers
  • 3.2 lesson practice edhesive ​
    6·1 answer
  • Privacy Group of answer choices must be respected if we are to function as complete, self-governing agents is an absolute value
    5·1 answer
  • Which of the following is the best name for a history report about world war 1
    7·1 answer
  • Ayudaa, 5 ejes de sistemas tecnológicos
    5·1 answer
  • Which of the following correctly declares and initializes a Scanner object that will use input from the keyboard as its data sou
    13·2 answers
  • What are the pros and cons of being a single decision maker
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!