Skip to content

Selection Sort

Complexity

  • Time complexity: $O(n^2)$
  • Space complexity: $O(1)$

Steps

  • Take the 1st element and compare it with all the other elements in the array, swap elements as needed it order to keep the lowest at the first position
  • Repeat the process n times, on each new iteration, the pivot element will be one position further