n-way merge sort