## Selection sort algorithm – Sorting algorithm – Program

Selection sort algorithm is where where we will find lowest value in collection and put it at first place till the collection is sorted.

For example lets say our collection is 4 ,7 ,3,8,2

Step 1: 2,4,7,3,8

Step 2: 2,3,4,7,8

And it will continue till 5 steps for each five numbers. It does not matter whether the array is sorted or not. Hence the Worst case scenario selection sort performance is O(n*n). Best case performance is also same. Hence it is advisable to not use this algorithm to sort big data. Its useful to sort big size files with small keys.

Algorithm is as follows:

for

i← 1 ton-1 do

minj←i;

minx← A[i]

forj←i+ 1 to n do

If A[j] < min x then

minj←j

minx← A[j]

A[minj] ← A [i]

A[i] ← minx

Admirablement reu !!! nul probleme merci

When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three emails with the same comment. Is there any way you can remove people from that service? Thanks!

Incredible! This blog looks just like my old one! It’s on a completely different subject but it has pretty much the same layout and design. Outstanding choice of colors!