k-way merge sort