Selection Sort:
Print this page
 
   
   
  • Pseudo code of the algorithm is given below.

Algorithm Selection_Sort (a[n])

Step 1: for i = 0 to n-2 do
Step 2:
lowest-key = i
Step 3: for j = i+1 to n-1 do {
if (a[i].key > a[j].key) then
Step 4:
lowest_key = j
Step 5:
swap(a[i], a[lowest_key]); }
Step 6:
                             
Prev