Merge-sort is not in-place. What extra memory does it need, and why is it still the sort of choice for huge inputs?
A merge cannot write its output over its own inputs, so it needs a buffer as large as the data: $O(n)$ extra memory. In return it reads and writes strictly front to back, which suits data that can only be read sequentially: linked lists, and files too big for main memory (external sorting).
In-place means that apart from a few variables (and the recursion stack) the sort works inside the input array. Selection-, insertion-, heap- and quick-sort can do that. Merge-sort's merge cannot: it fills a new sequence while it reads the two old ones, so at the top level it needs room for all $n$ elements a second time.
What merge-sort asks for instead is only sequential access: merge looks at nothing but the two fronts and appends at the back. That makes it the natural algorithm wherever jumping around in the data is expensive:
- Linked lists: merge-sort needs no indexing at all, and merging two lists can simply relink the nodes, so it doesn't even need a buffer.
- Files: the most common sequential structure of all. Merging two sorted files $A$ and $B$ into a third file $S$ needs only one record of each input in memory: compare the two current records, append the smaller one to $S$, read the next record from that file. Slow, because everything goes through the disk, but still $O(n \log n)$ and possible with almost no memory.
- External sorting: for data much larger than main memory, sort chunks that fit into memory, write them to disk as sorted runs, then merge the runs by streaming through them. Every run is read front to back, exactly the access pattern that disks and tapes handle well.
Go deeper:
External sorting — sorting runs in memory and merging them from disk, with a worked example.
Merge sort: use with tape drives — merge-sort on storage that can only be read front to back.