← Back to DSA Visualizer
Merge Sort Visualization
Merge Sort uses a divide-and-conquer approach to sort arrays. It divides the array into smaller subarrays, sorts them recursively, and then merges them back together in sorted order.
Time Complexity
Best: O(n log n)
Average: O(n log n)
Worst: O(n log n)
Space Complexity
O(n)
Comparisons
0
Array Access
0
0
800ms
Step 0 of 0 |Yellow: ComparingBlue: MergingGreen: Completed
How Merge Sort Works
- 1.Divide the array into two halves recursively
- 2.Continue dividing until each subarray has one element
- 3.Merge subarrays back together in sorted order
- 4.Compare elements and place smaller one first
Key Properties
- • Stable: Equal elements maintain relative order
- • Consistent: O(n log n) time complexity always
- • Divide & Conquer: Recursive problem solving
- • Memory: Requires O(n) additional space