Код
...
type
Tinf = string [20];
Ttree = ^TNode;
TNode = record
inf: Tinf;
left, right: Ttree;
end;
Tptr = ^Tlist;
Tlist = record
inf: Tinf;
next: tptr;
end;
TQueue = record
head,
tail: Tptr;
end;
...
function Find(Root: TTree; X: Tinf): TTree;
q: Tqueue;
begin
if Root = nil then Find := nil
else
if X = Root^.inf then Find := Root
else
if X < Root^.inf then Find := Find(Root^.Left, X)
else Find := Find(Root^.Right, X);
end;