Start here · Essential guide
Which Sorting Algorithms Are Stable?
Learn which sorting algorithms are stable, why stability matters when items share a key, and how Python, Java, and C++ handle equal keys in practice.
Algorithms
Which sorting algorithms keep equal items in order and whether sorting can beat O(n).
Start here · Essential guide
Learn which sorting algorithms are stable, why stability matters when items share a key, and how Python, Java, and C++ handle equal keys in practice.
Sorting can't beat linear time in general, since every item must be read. Comparison sorts need O(n log n), but counting sort can reach O(n) on limited keys.
Related topics