Merge sort is a recursive algorithm to arrange the elements of a data structure, such as an array or list, in increasing or decreasing order. The algorithm partitions the portion of the array into 2 unsorted halves, sorts each half, then merges the 2 sorted halves into 1 sorted whole.