logo CodeStepByStep logo

mergeSort1

Language/Type: C++ merge sort sorting
Related Links:

Trace the complete execution of the merge sort algorithm when called on the vector below, similarly to the example trace of merge sort shown in the lecture slides. Show the sub-vectors that are created by the algorithm and show the merging of sub-vectors into larger sorted vectors.

            // index    0   1  2   3   4   5   6   7
vector<int> numbers {29, 17, 3, 94, 46,  8, -4, 12};
mergeSort(numbers);

Format your answers with each sub-vector surrounded by { } braces, such as {1, 2} {3, 4}.

1st split
2nd split
3rd split
1st merge
2nd merge
3rd merge

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.