Step 1/0
Custom array:
Complexity
Best:O(n log n)
Average:O(n log n)
Worst:O(n log n)
Space:O(n)
Description
A divide-and-conquer algorithm that recursively splits the array in half, sorts each half, then merges them back together in sorted order.
When to use
Reliable O(n log n) for any input. Preferred for linked lists, stable sorting, and external sorting of large datasets.