procedure
FindMin(startindex:
integer;
var lowindex:
integer);
var lowelem: real;
u: integer;
begin
lowindex
:= startindex;
lowelem := M[startindex];
for
u:=startindex+1
to N do
if
M[u] < lowelem
then
begin
lowelem
:= M[u];
lowindex
:= u
end
end;
begin
for j:=1
to N-1 do
begin
FindMin(j,
i);
swap(M[j],M[i])
end
end.