Implement merge-sort algorithm.