home *** CD-ROM | disk | FTP | other *** search
- Program testtree;
-
- uses tree,crt;
-
- var root : t;
- n,m: TreePointer;
- x: integer;
-
- Begin
- x:=999;
- root:=NewTree(x);
- x:=123;
- AddTreeNode(root^,x);
- x:=456;
- AddtreeNode(root^,x);
- x:=567;
- AddtreeNode(root^,x);
- x:=765;
- addtreenode(Firstchild(root^),x);
- x:=678;
- addtreenode(Firstchild(root^),x);
- x:=159;
- addtreenode(Firstchild(Firstchild(root^)),x);
- x:=259;
- addtreenode(Firstchild(Firstchild(root^)),x);
- x:=359;
- addtreenode(Firstchild(Firstchild(root^)),x);
- x:=169;
- addtreenode(Firstchild(Firstchild(root^))^.brother,x);
- x:=269;
- addtreenode(Firstchild(Firstchild(root^))^.brother,x);
- x:=369;
- addtreenode(Firstchild(Firstchild(root^))^.brother,x);
- x:=789;
- addtreenode(Firstchild(root^),x);
- x:=888;
- addtreenode(firstchild(root^)^.brother,x);
- x:=777;
- addtreenode(firstchild(root^)^.brother,x);
- x:=555;
- addtreenode(firstchild(root^)^.brother^.brother,x);
- x:=444;
- addtreenode(firstchild(root^)^.brother^.brother,x);
- clrscr;
- writeln('Tree:');
- printtree(root);
- end.
-