Merge Sort on an input sequence with elements consists of three steps:

  • Divide: if has zero or one element, return . Otherwise, remove all elements from and put them in two sequences, and , each containing about half of the elements of . contains the first elements of and contains remaining items.
  • Recur: recursively sort and
  • Conquer: merge and into a sorted sequence

The base case for the recursion are subproblems of size or .