Sort Target
Algorithm
Speed
Normal ~12s · 53 ms ×2
std::sort (LLVM)(1998)
▶ Try this Source
O(n log n) ✗ Stable ✓ In-place
🔧 How it works

A re-implementation of the LLVM std::sort: uses median-of-three pivot selection, falls back to Heapsort after too many recursion levels, and switches to Insertion sort for sub-arrays below a fixed threshold.

🎯 Key property

Not a custom variant, this is the exact algorithm that has sorted data in C++ programs for decades, making it a direct historical baseline for comparing all other algorithms in this laboratory.

👁 Watch for
  • Compare (Quicksort phase) median-of-three pivot selection precedes each partition; the standard left-right scan and cross-boundary swaps follow
  • Swap (Heapsort fallback) when the recursion depth limit is exceeded, the algorithm switches to Heapsort's sift-down swap pattern
  • IndexWrite (Insertion sort finish) once sub-arrays fall below the small-array threshold, Insertion sort takes over with leftward element shifts
Initial State
This is the array before sorting. Follow std::sort (LLVM) step by step.
Recursion Tree
[0..31)51736248139151114101216211723192218202429253127302628
0 / 453 ops ( 0.0%) 0.0%
Sorting is
a spectacle.
Algorithms at work, in a daily vertical feed. Watch, play, challenge — and go deeper when you're ready.
Loading 0%
An unhandled error has occurred. Reload 🗙