minsort
N-i+2 steps
i ranges from 0 to N-1
(N+2) + (N+1) + É +3 steps
O(N2) steps
Similar analysis, with the same result, is obtained for:
bubble sort
simple insertion sort
(For a live demo, see:
http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html)