3. algorithm - Sort the data - Selection sort algorithm

One of the most commonly used, is a program to sort the data.

The main purpose is to arrange the data in a specific order so that they can be analyzed,

and on the basis of obtained results we can make ​​some of the many correct conclusions.

Before you start writing a program to sort the data you must do the following:

1. Good analysis what kind (type) of data is concerned, whether it comes to text or numeric data.

2. Good analysis of the data structure, perhaps they have already been sorted in some way.

3. Select the algorithm that best fits a given data type and structure, there are several types of algorithms,

and depending on the amount of data and applied algorithm depends the speed of sorting.

The most popular types of algorithms for sorting data:

Selection Sort, program

Insertion sort,

Bubble sort,

Shell sort,

Quick sort,

Merge sort,

Descriptions of algorithms can be found at this address

Algorithm that is included here is a "Selection sort" type algorithm.

The easiest to understand but it is the slowest of all algorithms when it comes to time spent for sorting.

Made to sort numbers in descending order, from largest to smallest.

Number of members of the series is limited to 5, a value must be a number from the set of real numbers.

Algorithm is based on the comparison of the first element in a row with a value of others and if one of them is larger performs a replacement, so that the maximum value after the first pass through the whole series, comes to the first place in the series.

This comparison operation is repeated, except that it moves from the second, third and fourth place, until the last place of the array.

So the next largest value in the series comes to the second, third, fourth and fifth place in the series.

This algorithm you can modify very fast to get a number sorted in the ascending order from smallest to largest.

Based on this algorithm was written program "Selection sort" located on the page "Free programs".

All the best,

Author