AlgoFrames

Breaking a tie in the merge

Warm-up · Multiple choice · about 2 min

The merge compares the fronts of the left half [3, 5] and the right half [5, 7]. 3 is already in the buffer, and both fronts are now 5. Which choice keeps merge sort stable?

Example 1

Input:

{"values":[3,5,5,7]}

Output:

[3,5,5,7]

Learn the idea first: Merge sort, a visual lesson.

More Merge sort problems