**Write an algorithm to sort an elements using Selection Sort Algorithm**.

*Algorithm for selection sort steps:*

*Step 1 : START*

*Step 2 : Input N*

*Step 3 : for I← 0 to N -1*

*Step 4 : Read A [ I ]*

*Step 5 : for I ← 0 to N -2*

*Step 6 : S ← A [ I]*

*Step 7 : POS ← I*

*Step 8 : for J ← I + 1 to N -1*

*Step 9 : If ( A[ J] < S )*

*Step 10 : S ← A [ J ]*

*Step 11 :*

*POS*

*← J*

*[ end of if ]*

*[ end of J for loop ]*

*Step 12 : A [*

*POS*

*] ← a[ I ]*

*Step 14 : A[ I ] ← S*

*[end of I for loop ]*

*Step 15: for I = 0 to N – 1*

*Step 16: Print A[ I ]*

*Step 17: Stop*

**Thanks**

**Mukesh Rajput**
## Post A Comment:

## 0 comments: