For the j > i case I think you're right, it sorts largest to smallest (or, backwards), but for the j < i case it grabs larger values from [0, i] that it initially moved to the top of the array and slots them back in, effectively (if roundabout-ly) correcting the backwards sorting of the j > i part of the algorithm. Sort of a "two wrongs that accidentally make a right" maneuver.
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
replies: