Sorting Algorithm Tutorials - Herong's Tutorial Examples - Version 6.01, by Dr. Herong Yang
Selection Sort - Algorithm Introduction
This section describes the Selection Sort algorithm - A simple and slow sorting algorithm that repeatedly selects the lowest or highest element from the un-sorted section and moves it to the end of the sorted section.
Selection Sort is a simple and slow sorting algorithm that repeatedly selects the lowest or highest element from the un-sorted section and moves it to the end of the sorted section.
The basic idea of Selection Sort algorithm can be described as these steps:
1. Data elements are grouped into two sections: a sorted section and an un-sorted section.
2. Assuming the sorting order is from low to high, find the element with the lowest comparable order from the un-sorted section.
3. Place the found element to the end of the sorted section.
4. Repeat step 2 and 3 until no more elements left in the un-sorted section.
The idea of selection sort comes from our daily life experiences. For example, at the end of card game, if you want to sort all the cards by rank and suit, you would put all the cards on the table, face up, find the lowest rank card, and it to the sorted piles, one pile per suit.
Last update: 2011.
Table of Contents