Merge SortΒΆ

A merge sort recursively breaks the values to be sorted in half until there is only one value to be sorted and then it merges the two sorted lists into one sorted list. The code shown below uses a second array the same size as the original array for merging the values in order. Then it copies all of the sorted values back into the original array.

Here is a folk dance video that shows the merge sort process.

To identify a merge sort look for the following:

The code for mergeSort below is from the AP CS A course description.

To see this executing using the Java Visualizer click on the following Merge-Sort

Next Section - Easy Multiple Choice Questions