Selection Sort

Repeatedly find the minimum element in the unsorted region and move it to the beginning

Size:
Speed:
Unsorted
Searching
Swapping
Sorted

About Selection Sort

Time Complexity:

  • Best: O(n²)
  • Average: O(n²)
  • Worst: O(n²)

Space Complexity: O(1)

Stable: No

How It Works

Selection Sort divides the array into sorted and unsorted regions. It repeatedly selects the smallest element from the unsorted region and swaps it with the first unsorted element.

The algorithm maintains a sorted region that grows from left to right until the entire array is sorted.

💡 Tip: Notice how the minimum element is selected in each pass!