Complete merge sort algorithm.