A distribution sort that classifies elements into m classes, permutes them into approximate order, then finishes with insertion sort. O(n) for uniform data.
Phase 1 - Classify: Find min/max. Count how many elements fall in each of m classes (like bucket boundaries). Phase 2 - Prefix sum: Convert counts to cumulative positions. Phase 3 - Permute: Cyclically move elements to their approximate correct positions using class info. Phase 4 - Insertion sort: Final cleanup since elements are nearly sorted.
Effectively a refined bucket sort. The colored zones show class boundaries.