This is a kind of a hybrid between a 'classic' bubble sort and a selection sort - but closer to the classic bubble sort.
In the classic bubble sort, the inner loop swaps adjacent pairs as it walks the list/array.
In the classic selection sort, the inner loop keeps track of the largest value it finds in the remaining portion of the list, and swaps it with the first value in the portion of the list that the inner loop is currently considering.
The sort as posted in the question is like the Selection sort in that the swap is always performed with the first value in the sub-list that the inner loop is considering. It's different from the Selection sort (and is similar to the classic Bubble sort) in that it performs a swap whenever it finds a value larger than the current first member of the inner loop's sub-list.
However, it's different than the classic Bubble sort in that it's not swapping adjacent pairs. In the classic Bubble sort, when the inner loop has finished working a round, the largest element of the list has filtered to the bottom of the list, but in this variation, the smallest element has filtered to the top of the inner-loop's sub-list.
I'd label this more a variation of the classic Bubble sort rather than the Selection sort because the performance characteristics of the sort in the question are the same as the classic Bubble sort (O(n^2)
comparisons and O(n^2)
swaps), while a Selection sort has O(n)
swaps.
But, one other difference between the classic Bubble sort and this one is that a classic Bubble sort is stable, while the sort in the question isn't. Consider the following list of items when run through the sort. Only the numbers are used in the comparison - the letters are used just to distinguish between the elements that have the same rank. The diagrams show the swap operations performed (in the interest of brevity, the comparisons aren't shown):
3.a 3.b 3.c 2.a 2.b 1.a
^ ^
+----------------+
2.a 3.b 3.c 3.a 2.b 1.a
^ ^
+----------------------------+
1.a 3.b 3.c 3.a 2.b 2.a
^ ^
+-----------------+
1.a 2.b 3.c 3.a 3.b 2.a
^ ^
+-----------------+
1.a 2.b 2.a 3.a 3.b 3.c
Note that at the end of the sort, the relative position of items 2.a and 2.b have changed, indicating a non-stable sort.