Selection sort works by splitting the input array into two parts: the list of numbers being built, from smallest to largest, and the remainder numbers that have yet to be sorted. Selection sort finds the smallest number from the unsorted list, and places it at the end of the sorted one. Rinse and repeat.
First, it sets the first element in the array as the current minimum, it then loops through the rest of the elements in the array and checks if each element is smaller than the current minimum. If the current element the loop is on, is smaller than the current minimum, the current element becomes the current minimum. The loop then continues checking the rest of the elements to see if they are smaller than the current minimum. When the loop reaches the end of the array, it then swaps the position of the current minimum and the first value in the array.
With a big O notation of O(n²), selection sort is another algorithm that is not very effective for sorting large arrays. While slightly outperforming bubble sort when working with small lists, selection sort is still viewed as a very slow algorithm.
