
298 Data Structures Using C
postOrderTravel (rightChild (Tree));
process DATA (Tree);
}
}
Example3: Write a program that creates a generalized binary tree and travels it using preorder strategy.
While travelling, it should print the data of the visited node.
Solution: We would use the algorithms createBinTree() and postOrderTravel(Tree)
to write the program. However, the code will be similar to Example 1. Therefore, only the function
postOrderTravel() is provided.
The required function is given below:
void postOrderTravel (struct tnode *binTree)
{
if (binTree == NULL) return;
postOrderTravel (binTree->leftChild);
postOrderTravel ...