4 ms·
I think it's more similar to insertion sort. In the first iteration of the outer loop, it moves the maximum to A[1]. After that, it works essentially like inser
by cato_the_elder 4y ago
I think it's more similar to insertion sort. In the first iteration of the outer loop, it moves the maximum to A[1]. After that, it works essentially like insertion sort, except that it does a bunch of unnecessary comparisons after finding the location to insert the element, and does the shifting in a slightly weird way.