Data Structure (2130702)

BE | Semester-3   Summer-2016 | 06/09/2016

Q4) (c)

Write an algorithm for Selection sort method. Explain each step with an example.

Algorithm:SELECTION_SORT(A)
 for i<-- to n-1 do
  min<--i;
 for j<--i+1 to n do
  if A[j]   min<--j
 if min!=i then
  temp<--A[i]
  A[i]<--[min]
  A[min]<--temp