Optimizations to min/max selection sort