Merge Sort Visualizer

Watch how Merge Sort uses divide-and-conquer to split the array into halves and merge them back in sorted order.

Time: O(n log n)
Space: O(n)
Stable: Yes
Divide & Conquer
Fast (500ms)Slow (3000ms)
Progress: Step 1 of 0Level 0 of 0 | Phase: start
640
341
252
123
224
115
906
Unsorted
Left Section
Right Section
Left Pointer
Right Pointer
Merging
Sorted

Current Step:

Click Start to begin the Merge Sort visualization

Algorithm Details

Best Case:O(n log n)
Average Case:O(n log n)
Worst Case:O(n log n)
Space:O(n)
Stable:Yes
In-place:No

When to Use Merge Sort

  • Large datasets requiring guaranteed O(n log n)
  • When stability is required
  • External sorting (data doesn't fit in memory)
  • Parallel processing applications
  • Memory-constrained environments

Real-world Applications

  • Database sorting operations
  • External sorting of large files
  • Parallel computing algorithms
  • Version control systems (like Git)
  • Inversion count problems