for i := 1 to m do
begin
b := 0;
l := i;
for j := i to m do
if x[j] > b then
begin
b := x[j];
l := j;
end;
x[l] := x[i];
x[i] := b;
for k := 1 to n do
begin
c := z[i, k];
z[i, k] := z[l, k];
z[l, k] := c
end;
end;
Тегами пользуемся...
for i := 1 to m do
begin
b := 0;
l := i;
for j := i to m do
if x[j] > b then
begin
b := x[j];
l := j;
end;
x[l] := x[i];
x[i] := b;
for k := 1 to n do
begin
c := z[i, k];
z[i, k] := z[l, k];
z[l, k] := c
end;
end;
for i := 1 to m do begin
b := x[i];
j := i - 1;
while (b < x[j]) and (j > 0) do begin
x[j + 1] := x[j]; j := j - 1;
end;
x[j + 1] := b;
end;