Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Please help me think about it and sort 10 integers (from small to large) by selection method.
Please help me think about it and sort 10 integers (from small to large) by selection method.
First of all, it is necessary to understand that this is the sort of a[ 1]~a[ 10], and a[0] is a temporary variable, tmp, which is used to exchange a[i] and a[min].

The algorithm traverses a[ 1]~a[ 10], selects the tag with the smallest value, stores it in the variable min (that is, selects the smallest one), and then puts the smallest one in front of (the unsorted part).