merge sort in-place implementation