Mergesort Proficiency Exercise Help Page

This exercise asks you to reproduce the merge behavior of the Mergesort algorithm on a random sequence of 10 values. Initially you will be presented with several blank arrays and 10 numbers in single element arrays at the bottom of the display. The things that you can do are: click on an element containing a number; and click on a blank element in an array one row above the currently selected element to move the selected element to that location.

Sort sublist of length 2

The first thing you need to do is select the smallest of the two bottom left-most elements (in the same row). Next, click the first blank element in the array above the two elements you just compared to move this value to the front of the sublist. Select the other element and move it to remaining blank element. The first sublist is now sorted.

Sort remaining sublists

If the two lists you are comparing contain a total of more than two elements, consider just the left-most elements of each list and select the smaller of the two. Move this value to the front of the merge list. Again, consider the left-most elements of each list, i.e. the remaining element from the previous comparison and the element directly to the right of the one which was just merged. Compare, select, merge and repeat until all the elements have been merged or one sublist is exhausted. When one sublist has been emptied, all the remaining elements can be moved to the merged list in their current order.

Repeat as needed

When two sublists are sorted, or contain single elements, they can be merged to form a single, sorted list. Follow the directions above to sort sublists so that they can be merged.

Other Controls: