complete merge sort algorithm