Merge Sort

Splits in half, sorts each half, merges sorted halves.

Method

Divide -> conquer -> merge; guaranteed O(n log n), stable.

Applications

External sorting, stable sort needs, parallel sorting.

Advantages

Predictable, stable, parallelisable.

Limitations

Uses O(n) extra memory; not in-place in classic form.

Example

Sorting [38,27,43,3] -> [3,27,38,43].

Sources

Educational reference only, not professional advice.

All algorithms