Natural merge sort implementation