unit Unit2;
interface
Procedure SORT(N:integer; var RA:array of real);
implementation
Procedure SORT(N:integer; var RA:array of real);
Label 99;
var
I,J,L,IR:integer;
RR,RRA:real;
begin
L:= N div 2 + 1;
IR:=N;
While true do
begin
If L > 1 Then
begin
L:=L - 1;
RRA:=RA[L];
end
Else
begin
RRA:=RA[IR];
RA[IR]:=RA[1];
IR:=IR - 1;
If IR = 1 Then
begin
RA[1]:=RRA;
goto 99;
end;
end;
I:=L;
J:=L + L;
While J begin
If J < IR Then
If RA[J] < RA[J + 1] Then J:=J + 1;
If RRA < RA[J] Then
begin
RA[I]:=RA[J];
I:=J;
J:=J + J;
end
Else
J:=IR + 1;
end;
RA[I]:=RRA;
end;
99: end;
end.