Algorithm for sorting elements using selection sort
Algorithm:
Step1: Start
Step2: Read the limit in n and data in a
Step3: Repeat step 4,5 and 6 while i<n-1
Step4: set small=i
Step5: Repeat step 6 while j<n
Step6: if a[small]>a[j],then
Set small=j
if i!=small,then
Swap a[i] and a[small]
Step7:Print the sorted array
Step8:stop
Ippo ok
ReplyDelete