Trees 303
void inOrderTravel (struct tnode *binTree)
{
if (binTree == NULL) return;
inOrderTravel (binTree->leftChild);
printf (“%c “, binTree->ch);
inOrderTravel (binTree->rightChild);
}
void postOrderTravel (struct tnode *binTree)
{
if (binTree == NULL) return;
postOrderTravel (binTree->leftChild);
postOrderTravel (binTree->rightChild);
printf (“%c “, binTree->ch);
}
The output of the program for choice 1 (inorder travel) is given below:
e Tree is …: P + Q / A − B
The output of the program for choice 2 (preorder travel) is given below:
e Tree is …: − + P / Q A − B
The output of the program for choice 3 (postorder travel) is given below:
e ...