It is a specially slow version of selection sort.
It looks like a bubble sort, but a bubble sort would compare/swap the elements at positions j-1
and j
, which are contiguous. You compare/swap the elements at positions i
and j
.
During every iteration of the outer loop, i
remains constant while j
advances from i+1
to the end. Thus, you end up having the element with the minimum value at position i
.
You probably make a lot of unnecessary movements. A proper selection sort would search for the minimum value without moving anything. Then it would swap that minimum value with the value at position i
. Therefore, it would perform only one swap per element in the array.