Selection Sort Visualizer

Watch how Selection Sort finds the minimum element in each pass and places it in the correct position.

Time: O(n²)
Space: O(1)
Stable: No
In-place: Yes
Fast (200ms)Slow (2000ms)
Progress: Step 1 of 0Pass 0 of 0
640
341
252
123
224
115
906
Unsorted
Current Position
Current Minimum
Comparing
Swapping
Sorted

Current Step:

Click Start to begin the Selection Sort visualization

Algorithm Details

Best Case:O(n²)
Average Case:O(n²)
Worst Case:O(n²)
Space:O(1)
Stable:No
In-place:Yes

When to Use Selection Sort

  • Small datasets where simplicity matters
  • When memory writes are costly (fewer swaps than bubble sort)
  • Educational purposes to understand algorithms
  • Large datasets (poor time complexity)
  • When stability is required

Key Characteristics

  • Always performs exactly n-1 swaps
  • Useful when write operations are expensive
  • Not adaptive (same performance regardless of input)
  • Can be made stable with careful implementation