Tag Archives: Selection Sort

Selection Sort

In Selection Sort algorithm, First, find the smallest element and swap it with the first. Sort the rest of the list the same way. Algorithm : for i in 0 .. n-2 small := i for j in i+1 .. n-1 if (a[j] < a[small]) small := j swap(a[i], a[small]) Example : 30 64 26 46 109 21… Read More »