Sort an array using the merge-sort algorithm.