Lingo

Merge Sort Visualiser

Step through each merge and watch two sorted runs combine through the auxiliary buffer.

Input

Split to single elements, then merge sorted runs through a buffer.

24

Complexity

Operations for n elements.

  • Best O(n log n)
  • Average O(n log n)
  • Worst O(n log n)

Stable · Needs O(n) space

Array
24
5
8
23
6
2
17
21
20
13
15
12
19
7
14
11
10
18
1
22
4
3
16
9

Split in half until each run is a single element.

1 / 137
0Comparisons
0Writes
1/137Steps
RunningResult

Merge sort done.