Selection Sort

I have been reading ahead in my textbook. The next chapter is on arrays. To help learn arrays well, the textbook goes over a number of sorting algorithms. One exercise just had me implement selection sort.

Selection sort is one of the easiest sort methods. It is an in-place algorithm, requiring no extra space in a array other than one temporary variable to do swaps.

The way selection sort works is to traverse the array, and swap the current element with the smallest value from the rest of the array. It could not get any simpler. However this technique has poor performance if you have many elements in the array.