Selection Sort
SortingEasySelect the minimum element from the unsorted zone and swap it to the front.
Alt+Shift+S
Configuration Panel
Scan / Min Swap Visualizer
230
81
562
123
384
55
726
167
Step: 1 / 1
Time Complexity
O(N^2) for all cases (always performs N^2 scans)
Space Complexity
O(1) auxiliary variables
Conceptual Overview
Selection Sort segments the list into sorted and unsorted zones, repeatedly finding the smallest element from the unsorted zone and swapping it into the next sorted position.
Algorithm Idea
Sweep the unsorted array to find the smallest element index. Swap it with the element at the boundary of the sorted and unsorted partitions.
Stable Sorting
Unstable (swaps can change original positions of equal elements)
In-place Memory
In-place (no auxiliary storage required)
Source: CP-Algorithms search & sorting reference