Visualize Merge Sort step by step. See how the divide-and-conquer approach splits the array in half, sorts each half, then merges them back in O(N log N) time.
Merge Sort is a divide-and-conquer algorithm. It divides the array in half, recursively sorts each half, then merges both.
Split the array down the middle into two sub-arrays.
Recursively sort each sub-array until you reach arrays of size 1 (trivially sorted).
Merge the sorted sub-arrays back together in the correct order.
Merge Sort guarantees O(N log N) and is stable, but requires O(N) extra memory.