# include & ltstdio.h & gt
# include & ltmalloc.h & gt
# Define Maximum Node 50
Typedef structure bit node
{
Char data;
BiTNode *lchild,* rchild
}BiTNode,* BiTree
BiTree create BiTree();
void in order traverse(BiTree T);
creatTree.cpp
# contains "tree.h"
BiTree CreateBiTree()
{
BiTree T;
char ch
scanf("%c ",& ampch);
if (ch=='# ')
{
T = NULL
return T;
}
other
{
t =(bit node *)malloc(sizeof(bit node));
if (T==NULL)
{
Printf ("Tree creation failed!" );
T = NULL
return T;
}
t->; Data = ch
t->; l child = create bitree();
t->; rchild = create bitree();
return T;
}
}
InorderTraverse.cpp
# contains "tree.h"
Null in ergodicity (binary tree t)
{
BiTree stack [MAX_NODE], p = T;;
int top=0,bool 1 = 1;
if (T==NULL)
Printf ("Binary tree is empty! \ n ");
other
{
do
{
And (p! = empty)
{
stack[++ top]= p;
p = p-& gt; lchild
}
if (top==0)
{
bool 1 = 0;
} Otherwise {
p = stack[top];
top-;
printf("%c ",p-& gt; Data);
p = p-& gt; rchild
}
} while (bool 1! =0) ;
}
}
main_fun.cpp
# contains "tree.h"
int main()
{
BiTree T = create BiTree();
in order traverse(T);
Returns 0;
}
traverse.cpp
# contains "tree.h"
Unprecedented ordered traversal (binary tree t)
{
If (t! = empty)
{
/* Access the root node */
Preorder traversal (t->; l child);
printf("%c ",T-& gt; Data);
Preorder traversal (t->; rchild);
}
}
For example, enter AB###
Output BA
First-order input and intermediate-order output
You can modify the traversal mode to change the output.