Bottom-up merge sort from Okasaki