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
Digiron [165]
3 years ago
13

Mergesort uses the divide-and-conquer technique to sort a list. True False

Computers and Technology
1 answer:
NARA [144]3 years ago
6 0

Answer:

True: Merge Sort sorts a list using divide-conquer approach.

<u>Merge_Sort(B,p,n)</u>  //p is the starting index of array B and n is the last index.

1. if(p<n)

2.        q ← (p+n)/2    //divides the list into two sub-lists

2.        Merge_Sort(B, p, q) //sorts the left half

3.        Merge_Sort(B, q+1, n) //sorts the right half.

4.        Merge(B, p, q, n)

<u>Merge(B, p, q, n)</u>

1.l ← q-p+1.  //no. of elements in left half

2.m ← n-q  //no. of elements in right half.

3.for x ← 1 to l

4.      Left[x] = B[p+x -1] //The elements of left half are copied to Left array

5.for y ← 1 to m.

6.      Right[y]= B[q+y]  //The elements of right half are copied to right array

7. x ← 1, y ←1

8.for z ← p to n.

9.      if( Left[x] ≤ Right[y] ) // to merge the two lists Left and Right, the    //elements are compared.

10.     {   A[z] ← Left[x]   //smaller one comes to the merged list.

11.          x++. }

12.    else

13.      {   A[z] ← Right[y]

14.          y++ }

Explanation:

The Merge_Sort(A, p, n) algorithm first divides the whole array into two halves. Then again divides the sub-lists into it's halves and so on.

Then using merge algorithm it compares the elements of both halves one by one and keep it in sorted order.

You might be interested in
By default, PowerPoint ends a slide show with a black slide. <br> a. True<br> b. False
Dmitry [639]
True . Because Press " ESC " To Exit Off Of Slide . 
5 0
3 years ago
Read 2 more answers
Create an array to hold the rainfall values. Create a 2nd parallel array (as a constant) to hold the abbreviated names of the mo
Zarrin [17]

Answer:

#include <stdio.h>

int main()

{

//variable declaration

int low, high;

float lowRain, highRain, total, avg;

 

//array declaration

float rainfall[13];

char monthName[13][10] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

//get user input

for(int i=1; i<=12; i++)

{

printf("Enter the rainfall (in inches) for %s: ", monthName[i]);

scanf("%f", &rainfall[i]);

}

 

//display the monthly rainfall

printf("\nThe rainfall that was entered was:\n");

for(int i = 1; i<=6; i++)

printf("%s ", monthName[i]);

printf("\n");

for(int i = 1; i<=6; i++)

printf("%.1f ", rainfall[i]);

printf("\n");

for(int i = 7; i<=12; i++)

printf("%s ", monthName[i]);

printf("\n");

for(int i = 7; i<=12; i++)

printf("%.1f ", rainfall[i]);

 

//variable initialization

low = 1;

high = 1;

lowRain = rainfall[1];

highRain = rainfall[1];

total = 0;

 

//calculate the lowest, highest and averaage rainfall

for(int i=1; i<=12; i++)

{

if(lowRain>rainfall[i])

{

lowRain = rainfall[i];

low = i;

}

if(highRain<rainfall[i])

{

highRain = rainfall[i];

high = i;

}

total = total + rainfall[i];

}

 

avg = total / 12;

 

//display the result

printf("\n\nThe total rain that fell was %.1f inches", total);

printf("\nThe average monthly rainfall was %.1f inches.", avg);

printf("\nThe lowest monthly rainfall was %.1f inches in %s.", rainfall[low], monthName[low]);

printf("\nThe highest monthly rainfall was %.1f inches in %s.", rainfall[high], monthName[high]);

return 0;

}

4 0
3 years ago
A compression scheme for long strings of bits called run-length encoding is described as follows: Rather than record each 0 and
Musya8 [376]

Answer: (B) Lossless compression

Explanation:

 According to the question, the given technique is the example of the lossless compression. The lossless compression is one of the technique that decompress the data into the original data form without any type of losses.

The lossless compression is the technique that usually compress the data, text and the databases. This technique also improve the compression rate helps in reconstruct the original data. It is used in various types of encoding methods, GNU tool and zip file.

3 0
3 years ago
What are some of the functions in the Consolidate dialog box? Check all that apply.
goblinko [34]

Answer:

sum average and count is the answer

5 0
3 years ago
How do you create a algorithm?
aksik [14]
Make sure that each box has an arrow going to it or leading from it, if it needs one. Select “Insert,” then “Shapes,” and choose the Text Box option: Page 2 [Algorithm how-to procedure] 2 Drag the cursor across the document to customize the size of the text box. Click inside the box to begin typing.
brainliest pls
6 0
2 years ago
Read 2 more answers
Other questions:
  • A(n) ________ converts your voice's sound waves into digital signals.
    9·1 answer
  • 1. Zack sees an online contest. He could win $10,000 instantly! On the sign-up form, he enters his name and email address. He is
    15·1 answer
  • What is the base for a hexadecimal number system?
    11·1 answer
  • Is there a relationship between cybercrime and traditional crime?
    6·1 answer
  • Please select the word from the list that best fits the definition
    13·2 answers
  • You have just purchased a server with Windows Server 2016 Datacenter Edition installed. The server has 4 GB RAM, a 200 GB hard d
    6·1 answer
  • Match each code snippet to its appropriate markup language name
    12·1 answer
  • Computer C’s performance is 4 times as fast as the performance of computer B, which runs a given application in 28 seconds. How
    5·1 answer
  • What is a computer please tell me ​
    10·2 answers
  • Compare the freedom available to the American media with the freedom available to media in other parts of the world. How does a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!