Sorting algorithm
A method for ordering elements by a comparison rule — the most thoroughly studied problem in all of computer science.
Comparison-based sorting provably cannot beat O(n log n), because n elements have n! possible orderings and each comparison only halves the search space. Quicksort, mergesort and heapsort all reach that bound with different trade-offs in memory, stability and worst-case behaviour. Counting sort and radix sort escape the bound by not comparing at all, but require keys to be integers in a known range.
In practice nobody writes their own. Standard libraries ship hybrids refined over decades — introsort in C++ (quicksort that switches to heapsort when recursion gets deep), Timsort in Python and Java for objects, pattern-defeating quicksort in Rust. The interesting question is rarely which algorithm but which comparison: text collation differs by language, and an inconsistent comparator yields undefined behaviour rather than merely the wrong order.