C++ Sorting Algorithms [closed]

Make one pass through the sequence to find the largest value, the second largest value, and the smallest value. Swap the largest to one end, the second largest to the other end, and the smallest to the middle. Voila: largest items are on the ends and the smallest is in the middle. Calling this a “sort” is silly.

Leave a Comment