Merge Sort is an efficient, stable divide-and-conquer algorithm that divides the input array into two halves, recursively sorts them, and then merges the sorted halves.
Adjust the array size and animation speed to see how Merge Sort performs on different data sets.
Algorithm | Best Case | Average Case | Worst Case | Space | Stable |
---|---|---|---|---|---|
Bubble Sort | O(n) | O(n²) | O(n²) | O(1) | Yes |
Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) | No |
Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | Yes |
Insertion Sort | O(n) | O(n²) | O(n²) | O(1) | Yes |
Selection Sort | O(n²) | O(n²) | O(n²) | O(1) | No |
Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) | No |