merger sort implementation. This sorting algorithm has O(nlogn) complexity.