Merge Sort

Merge Sort is an efficient, stable, divide-and-conquer sorting algorithm. It works by dividing the array into halves, sorting each half, and then merging them back together. The merge operation efficiently combines two sorted arrays into one.

Steps:

  1. Divide the array into two halves
  2. Recursively sort each half
  3. Merge the sorted halves to produce the final sorted array

Time Complexity

Best: O(n log n)

Average: O(n log n)

Worst: O(n log n)

Space Complexity

O(n)

Array length:

7

Speed:

Canvas is not supported in your browser. Please use Edge or Chrome.