Question: Code the merge sort in C++. Make sure to base your code on the pseudocode in the book (not on things that you find on

Code the merge sort in C++. Make sure to base your code on the pseudocode in the book (not on things that you find on the internet). Create 2 .cpp files: sortMain.cpp and mergeSort.cpp. Below is a template that you should use:

 //---------------------------------------------------------------------- //file: sortMain.cpp #include  #include  extern void mergeSort ( int A[], int n ); using namespace std; int main ( int argc, char* argv[] ) { . . . } //---------------------------------------------------------------------- //file: mergeSort.cpp void mergeSort ( int A[], int n ) { . . . } //free to define other functions of your own. 

Run the sort on input sizes of 10, 100, 1000, 10000, 100000, 200000, 300000, 400000, 500000, and 1000000 of random values. Depending upon the speed of your computer, you may only be able to run one or a few sorts for larger input sizes. Report the array size n (N), number of test iterations (#), total elapsed time (tElapsed), total CPU time (tCPU), average CPU time (avgCPU) for insertion sort in a table like the following:

merge sort

N # tElapsed tCPU avgCPU
10
100
1000
10000
100000
200000
300000
400000
500000
1000000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!