I will try to explain a little about the Selection Sort algorithm that I have learned and understood. Before you go any further I tried to interpret the meaning of the first syllable. When viewed Selection Sort can be interpreted as sorting is done using a selection process. What was selected? Of course the data to be sorted. Selection of this sort, including sorting categories that are still using comparative data or known by the Comparison Sort example like Bubble Sort Sort, Selection Sort, Insertion Sort, Merge sort.
The algorithm in this sorting process (Comparison Sort) is to do a comparison between the data which was followed by the exchange of data if not in accordance with certain requirements.

To more clearly now I'll try to explain how the algorithm and the process of selection sort.
Example:
there is a group of arrays which have the following sequences,
33, 41, 4, 16, 21, 9, 13 33, 41, 4, 16, 21, 9, 13
Then the algorithm as follows;
- Determine the minimum index of the data array. Let's just say that the minimum index of the number of visits to the bil-i [i] untill bil [length-1] and store in variable min.
- Then compare with the data bil [j] is larger than the data bil [min]. If true then min = j
- Once all data have been compared, then exchange bil[i] with bil[min] if min condition was not equal to i
for the detail you can see Illustration process below this
Blue: Index Minimum Red: Data are already sorted
I've made a Selection Sort program using C language
Code : Selection Sort
I hope what I have to say can be useful to you guys
:cheers
0 comments