Answer the question
In order to leave comments, you need to log in
Binary search tree?
There is a structure for a binary search tree
U = ^BTS;
BTS = record
inf : integer; //Ключ\Данные
L : U; //Левый потомок
R : U; //Правый потомок
end;
..
procedure CTree(var Tree : U; R : integer;);
begin
if Tree = Nil
then
begin
New(Tree);
Tree^.L := Nil;
Tree^.R := Nil;
Tree^.inf := R;
end
else
if R <= Tree^.inf
then CTree(Tree^.L,R)
else CTree(Tree^.R,R)
end;
..
Randomize;
..
for i:=0 to n-1 do
begin
r := random(30);
CTree(a, r);
end;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question