Merge sort

What two sorted halves are merged in the final step?

Examples

Worked example

Input
[6, 1, 4, 3]
Expected output
[1, 6] and [3, 4]

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

The original halves [6, 1] and [4, 3] sort independently. Their final merge gives [1, 3, 4, 6].

Back to the lesson