How it works
Merge sort
A stable divide-and-conquer sort with guaranteed O(n log n) time and O(n) extra space.
Quicksort
Partitions around a pivot for fast average O(n log n) time in place, but O(n squared) in the worst case without good pivots.
Stability and space
Interviews often ask whether a sort is stable and how much extra memory it needs.