In this problem you should hack the sorting algorithm, of course it was incorrect. It was correct only for arrays with n < = 2. In other cases you could print n, n–1, ..., 1 as a counter-example. To make the sorting right, the second cycle should be from 1 but not from i.
0 Comments
If you have any doubts, Please let me know