← Back to All Algorithms
🔀 Merge Sort
How It Works (Divide & Conquer)
Divide:
Split array into two halves
Conquer:
Recursively sort each half
Combine:
Merge the sorted halves into one sorted array
Key Insight:
Merging two sorted arrays is O(n). We do O(log n) levels of merging.
Click "Start" to begin Merge Sort
Reset
▶ Start
Step →
Complexity
Time:
O(n log n) — always (best, avg, worst)
Space:
O(n) — needs auxiliary array
Stable:
Yes