Sorting Algorithms - Selection

Other algorithms: Bubble | Insertion | Selection | Merge | Quick

Description

Compare each item until you find the lightest and put it to one side. Repeat for the remaining list.

Detailed Instructions

  1. Compare Box1 with Box2.
    Put the heaviest one to one side.
    Compare the remaining box to Box3.
    Repeat until you have found the lightest box.
    Put this box in position 1.

  2. Repeat step 1 for the remaining boxes, filling in the next position.

  3. Repeat step 2 until the sort is complete.

  4. And finally, once you've completed the exercise, try to work out the maximum number of comparisons you would need to solve the problem with different numbers of boxes.
Number of boxes Maximum number of comparisons
2
1
3
4
5
6

Creative Commons License
Sorting Algorithms by Mark Clarkson is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.