[Tree] General tree
Have yourself a lot of time to learn how to install and enter, approval of the general tree, however, only found a way to install a number of methods rather not see the code in and browse the extensive plant specific…
There are several ways to install and browse tree, you can consult online. This article only mentions his 1 fraction.

Here is the code installed, Import, and general plant approved in advance in order, các phép toán khác các bạn tự phát triển hoặc trong một ngày đẹp trời nào đó mình lại viết tiếp 😀
PROGRAM CAY_TONG_QUAT;
uses crt;
const n = 12;
type
item = char; {Kieu phan tu}
pointer = ^node;
node = record
info : item;
numChild : integer; {so con cua 1 nut}
child : array[1..n] of pointer;
end;
var
T : pointer;
procedure inputTree(var T: pointer); {nhap vao cay}
var
i: integer;
p: pointer;
begin
if T = nil then
begin
new(T);
write('Nhap nut goc: ');
readln(T^.info);
end;
p:= T;
write('Nhap so con cua node ', p^.info, ' : ');
readln(p^.numChild);
for i:=1 to p^.numChild do
begin
new (p^.child[i]);
write('Nhap nut con thu ', i, ' : ');
readln(p^.child[i]^.info);
end;
for i:= 1 to p^.numChild do
inputTree(p^.child[i]);
end;
procedure duyetTruoc(T: pointer);
var
i: integer;
begin
if T <> nil then
begin
write(T^.info, ' ');
for i:=1 to T^.numChild do
duyetTruoc(T^.child[i]);
end;
end;
BEGIN
clrscr;
inputTree(T);
duyettruoc(T);
readln;
END.
Code cũng dễ hiểu nên mình không chú thích gì thêm 🙂
Read more: Some operations on a binary search tree



a ơi cái này có phải là cây đồ thị trie không ạ
Mình không hiểu bạn nói đến cây đồ thị là thế nào, đề bài nêu rõ là cây tổng quát mà 🙂
Cảm ơn về bài code. Thuật toán rất dễ hiểu. Even though I haven't learned this programming language yet, I'm just learning C ++.