procedure delete ( var pq : tree );
begin
if pq = nil then Error {*** deletion on an empty queue ***}
else if pq^.left = nil then pq := nil
else if pq^.left^.left = nil then begin
pq^.left := pq^.right;
pq^.right := nil
end
else delete( pq^.left )
end;
|