Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement, in C++, the following three advanced sorting algorithms: merge sort,

ID: 3654842 • Letter: I

Question

Implement, in C++, the following three advanced sorting algorithms: merge sort, quick- sort, and heap sort. Investigate their performance over arrays of sizes n = 102, 103, 104, 105, and 106. For each of these sizes consider the following three types of input:

a. randomly-generated integers between 1 and n (inclusive). You may use a dis- tribution where each integer is equally likely.

b. increasing integers 1, 2, . . . , n.

a. decreasing integer n, n ? 1, . . . , 1.

For each of the above types of data, generate a graph which compares

input size with (actual) running time. In a brief report containing the graphs

and conclusions that you've drawn from the experiment.

Explanation / Answer

Merge Sort Implementation ---- #include using namespace std; void merge(int*,int,int,int); void mergesort(int *a, int low,int high) { int pivot; if(low