AP® Computer Science A · Unit 4 · Topic 4.15
Selection Sort, Pass by Pass
Watch it explained
- How it worksHow does each pass scan the unsorted tail for a minimum and swap it into position?
- Worked exampleTrace selection sort on {29, 10, 14, 37, 13}, showing the array after every pass.
- Worked exampleFind how many swaps and how many comparisons selection sort makes on 5 elements.
- Common mistakeWhy doesn't selection sort finish early when the array is already in order?
Check yourself
Your turn1 of 2
Selection sort scans the unsorted tail for a minimum on every pass, across an array of 15 elements. In total (summed across all passes), how many comparisons does it make?End of topic.