1preorder: parent => left => right
2inorder: left => parent => right
3postorder: left => right => parent
1Input:
2N = 5
3arr[] = {40,30,35,80,100}
4Output: 35 30 100 80 40
5Explanation: PreOrder: 40 30 35 80 100
6InOrder: 30 35 40 80 100
7Therefore, the BST will be:
8 40
9 / \
10 30 80
11 \ \
12 35 100
13Hence, the postOrder traversal will
14be: 35 30 100 80 40