selection sort Algorithm

The algorithm proceeds by finding the smallest (or largest, depending on sorting order) component in the unsorted sublist, exchange (swapping) it with the leftmost unsorted component (putting it in sorted order), and move the sublist boundaries one component to the right. It has an O(n2) time complexity, which makes it inefficient on large lists, and generally performs worse than the like insertion sort.

selection sort source code, pseudocode and analysis