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:
- If you want to back up a step and try again, click the "Undo" button.
- If you want to restart the exercise, click the "Reset" button.
- If you want to see the correct answer, click the "Model Answer" button to see a slideshow in a pop-up window.
- Note: Viewing the answer will prevent you from obtaining credit for the current problem instance. So just hit "reset" when you are done viewing the model answer.
- The button with gears on it will let you set some options such as the animation speed (for the slideshow model answer).
- The "About" button will tell you about who wrote this, etc.
- The "Help" button got you here.