Selection sort
In sectional sort, if there are “n” elements then in the first pass we search through the table and find the smallest element when found we interchange with the element at the first position.
In the second pass, we locate the second-lowest element and when found we interchange with the element at the second position. And so on.
The selection sort algorithm is also called as Exchange sort algorithm. The technique of selection sort algorithm is very simple as shown below.
step 1: It searches for the smallest element in the array and swaps it with an element array[0].
step 2: Then it searches for the second smallest element in the array and swap it with an element array[1].
step 3: This process will be repeated until the n-1 element in an array is sorted.
Advantages:
• Easy to implement.
• Requires no additional storage space.
• It performs well on a small list.
Disadvantages:
• Poor efficiency when dealing with a huge list of items.
• Its performance is easily influenced by the initial ordering of the items before the sorting process.
• It lacks efficiency on a huge list of items.
• It does not stop unless the number of iterations has been achieved even though the list is already sorted.