The idea
Key formulas
Merge-sort recurrence
Comparisons during a merge
Loading lessons…
Just a moment, getting everything ready. The first load can take up to a minute.
Data structures and algorithms
Trace divide-and-conquer sorting, recursion trees, merge comparisons, and selectable quicksort pivots.
Merge sort divides an array, recursively sorts each half, then merges the sorted results. Quicksort partitions around a pivot and recursively sorts the two sides. Both expose their recursive calls as a tree; pivot choice can change quicksort's tree and work.
The seeded pivot mode is repeatable. Duplicate keys are supported, and the input is capped so every recursion tree remains inspectable.