Sorting Algorithm Tutorials - Herong's Tutorial Examples - 6.12, by 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, add it to the sorted piles, one pile per suit.
Table of Contents
Introduction of Sorting Algorithms
Java API for Sorting Algorithms
Insertion Sort Algorithm and Java Implementation
►Selection Sort Algorithm and Java Implementation
►Selection Sort - Algorithm Introduction
Selection Sort - Java Implementation
Selection Sort - Implementation Improvements
Bubble Sort Algorithm and Java Implementation
Quicksort Algorithm and Java Implementation
Merge Sort Algorithm and Java Implementation
Heap Sort Algorithm and Java Implementation
Shell Sort Algorithm and Java Implementation
Sorting Algorithms Implementations in PHP
Sorting Algorithms Implementations in Perl
Sorting Algorithms Implementations in Python