Merge Sort

Objective

The objective of this experiment is to demonstrate the recursive nature of the mergesort algorithm by interacting with the recursive substructures that emerge from the split and merge operations.

Experiment Setup

Initial

Initially this experiment presents you with a directed graph having two nodes. The root node that contains the list to be sorted and a node named "MS" that represents the mergesort operation with the list in the root node as the input.

You can click on the "MS" node to expand the graph. If the input array is of length 1, then the graph does not expand, it just adds a new outgoing edge that represents the sorted array of size 1 that was given as input to the MS node.

Split

When you encounter a "split" node, click on that node and observe that the input array splits into two in the outgoing edges of the split node. This represents the split operation of the mergesort algorithm.

Merge

The Merge node can only be clicked on when the input nodes contain sorted arrays. If this is true, then clicking on the merge node results in the merged list of the two input arrays.

Procedure

Click on different nodes (MS, Merge, Split) until you get the sorted list at the end of the graph. Observe that the order in which you do these operations does not affect the result.