Selection sort is basically a selection of an element position from the start with the other rest of the elements.
Elements are compared and exchanged depending on the condition and then selection position is shifted to the next position till it reaches to the end.
Here are the selection positions of these elements. Comparion takes place with selected position to the rest of the next positions.
Selection sort Big(o)
Selection sort of N elements can take (N - 1) steps and (N - 1) iterations in each steps. Thus resultant is (N-1)*(N-1).
This sorting algorithm is not however the best in performance when count of the elements are large.
Time complexities of Selection sort is Big(o) = N^2. This sorting is well suited for small number of elements and it is easy the implement in C or any other programming languages.
Selection sort source code
Here is a C source code of Selection sorting with 5 integer elements. This code sorts the elements in ascending order.