function A=sort_sel(A)  % Sorting by selection
  n=length(A);          % selection sort
  for  i=1:(n-1)
     index=i ;
     key = A(i);
     for j = i+1:n
       if A(j) < key
         index= j;
         key=A(j);
       end
     end
     if (index ~= i)
         A(index)=A(i);
         A(i)=key; 
     end
   end
end
