clear;
a=randperm(1000);b=a;
tic;
for k=1:length(a)-1
    min=a(k);
    s=k;
    for n=k+1:length(a)
        if(a(n)<min)
            min=a(n);s=n;
        end
    end
    t=a(k);a(k)=a(s);a(s)=t;
end
time1=toc;
disp(['The calculation needs ',num2str(time1),'second']);
tic;
sort(b);
time2=toc;
disp(['The calculation needs ',num2str(time2),'second']);
