Sorting visualizer

Merge Sort

Divide the array, then merge sorted halves.

Example Array
[42, 17, 8, 33, 25, 11, 60, 29]

Visualization

Ready
ComparingMoving / writingPivotSorted

Merge Sort is ready to divide and merge the array.

Metrics

Comparisons0
Writes0
Progress0%
Time taken0.0s

Pseudocode

  1. mergeSort(arr, left, right)
  2. middle = (left + right) / 2
  3. mergeSort(left half)
  4. mergeSort(right half)
  5. compare values from both halves
  6. copy remaining left values
  7. copy remaining right values
  8. merge both halves
  9. return arr

About Merge Sort

Merge Sort recursively divides the array into smaller halves and combines them in sorted order. Its predictable time complexity makes it effective for large datasets.

Sorted Output

[ 8, 11, 17, 25, 29, 33, 42, 60 ]

Complete the visualization to reach this output.

Complexity Overview

Best CaseO(n log n)
Average CaseO(n log n)
Worst CaseO(n log n)
SpaceO(n)
StableYes