Selection Sort is a list sorting algorithm. It is very easy to implement but is rather inefficient.

Algorithm Edit

For each position in the List the algorithm searches for the smallest Item in the list starting at that point. When that item is found it is swapped into the current position.


   for i = 1 to n-1
      min = i
      for j= i+1 to n
         if A[j]<A[i]
            min = j
            temp = A[i]
            A[i] = A[min]
            A[min] = temp

 See Also Edit

Sorting algorithms
Bubble sort - Insertion sort - Merge sort - Quicksort - Selection sort - Heap sort