Merge ยท Quick ยท Stability

Sorting Algorithms Visualizer

Shuffle, sort, and study visual patterns and complexity. Switch algorithms to see how comparisons and swaps evolve over time.

๐Ÿ“Š Array Bars
โš™๏ธ Controls

๐Ÿ“š Sorting Fundamentals

๐ŸŒ Applications

โ“ Frequently Asked Questions

1) Why is quicksort fast on average?
Good partitioning yields O(N log N) comparisons on average.
2) When is merge sort better?
Stable, predictable O(N log N), great for linked lists and external sorting.
3) Is quicksort stable?
Classic quicksort is not stable; special variants can be.
4) What about Timsort?
Hybrid of merge and insertion used in Python; exploits runs.
5) Why visualize?
Bar movements reveal algorithmic patterns and data sensitivity.
6) Heap sort?
In-place O(N log N) but poor locality; rarely fastest in practice.
7) Are there linear-time sorts?
Counting/radix for integers/strings under constraints.
8) Parallel sorting?
Samplesort, bitonic sort; also map-reduce approaches.
9) Best for nearly sorted data?
Insertion sort often shines; quicksort with median-of-three helps.
10) Why worst-case O(Nยฒ)?
Adversarial input for quicksort partitions leads to degeneracy.