procedure insert( new : ArrayEntry; var r : RecordArray );
var i, j : integer;
flag : boolean;
begin
n := n+1;
j := n;
flag := true;
while flag and (j>1) do begin
i := j div 2;
if r[i].k >= new.k then flag := false
else begin r[j] := r[i]; j := i end
end;
r[j] := new
end;
|