This page is the module index for sorting extras.
This legacy page is the implementation map. Use the focused pages for counting and radix sorts, order-statistic selection, binary search on a feasible answer, and inversion counting.
sorting/selection_and_radix.py— comparison lower bound, counting and LSD radix sorts, quickselect, binary search on the answer, inversion count.
Industry
A working engineer does not sort the whole input when only the smallest few
values are required. Python's sorting howto points at heapq.nsmallest for
that job: one pass that keeps only the requested number of elements. Digit
keys are the other case in this lesson, counting sort and LSD radix, because
a comparison lower bound does not apply to them.