Table of Contents
Our next algorithm actually achieves the optimal big-O behavior for a sorting algorithm. The Merge sort has O(n log n) time for both its worst and average case.
This doesn't necessarily make it the ideal choice, however, in all sorting applications. The constant multiplier on the timing is somewhat high, and Merge sort may require an unusually high amount of memory.
Variants of the basic Merge sort algorityhm are, however, often used with linked lists (which can't be sorted by most other O(n log n) algorithms and are used to sort data residing on disk or magnetic tape.