Sorting visualizer
Selection Sort
Select the smallest remaining value for each position.
Example Array
[42, 17, 8, 33, 25, 11, 60, 29]Visualization
ComparingMoving / writingPivotSorted
Metrics
Comparisons0
Swaps0
Progress0%
Time taken0.0s
for i from 0 to n - 2minIndex = ifor j from i + 1 to n - 1if arr[j] < arr[minIndex]minIndex = jswap arr[i] and arr[minIndex]return arr
About Selection Sort
Selection Sort scans the unsorted section to find its minimum value, then places that value at the next position in the sorted section.
Sorted Output
[ 8, 11, 17, 25, 29, 33, 42, 60 ]Complete the visualization to reach this output.
Complexity Overview
Best CaseO(n²)
Average CaseO(n²)
Worst CaseO(n²)
SpaceO(1)
StableNo