Inplace merge sort