built byKyle

Merge Sort

Recursively splits the array in half, then merges sorted halves back together.

0 elements
>Ready — Merge Sort
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Analysis
BEST O(n log n)
AVG O(n log n)
WORST O(n log n)
SPACE O(n)
STABLE

Merge Sort splits the array recursively until each piece has one element, then merges them back in sorted order. Guarantees O(n log n) time but needs extra memory for temporary arrays.

Edit in playground