Divide and Conquer: Merge Sort Visualizer

This visualization demonstrates the Merge Sort algorithm, which follows the Divide and Conquer approach. The algorithm recursively divides the array into smaller subarrays, sorts them, and then merges them back together.

Click "Generate New Array" to start

How Merge Sort Works

Merge Sort is a divide and conquer algorithm that works as follows:

  1. Divide: The array is recursively divided into two halves until each subarray has only one element.
  2. Conquer: Each subarray of one element is considered sorted.
  3. Combine: The sorted subarrays are merged back together in a sorted order.
Time Complexity (Best)
O(n log n)
Time Complexity (Average)
O(n log n)
Time Complexity (Worst)
O(n log n)
Space Complexity
O(n)