so ok, i have this code :
Delphi-Quellcode:
procedure TBinTree.BuildHeap;
begin
if not(Left=nil) then
begin
if Left.Value>Value then
begin
Exchange(Left,Self);
BuildHeap;
end;
Left.BuildHeap;
end;
if not(Right=nil) then
begin
if Right.Value>Value then
begin
Exchange(Right,Self);
BuildHeap;
end;
Right.BuildHeap;
end;
end;
it works fine, but only just with one bug, it exchanges bad the values by the tree root (it dont makes just one exchange, the rest of the tree is ok)
somebody has an idea how to fix it?