Is there a binary tree whose post order and pre order traversals are same?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 20

Is there a binary tree whose post order and pre order traversals are same??

3rd Dec 2017, 6:05 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
6 Answers
+ 9
in tree traversal technique for preorder we have to first start traversing from root left node and right node whereas in post order first we have to visit left and right node than root so the sequence of traversal is different
3rd Dec 2017, 6:11 AM
Anisha
Anisha - avatar
+ 7
maybe anything is possible
3rd Dec 2017, 6:06 AM
chris
chris - avatar
+ 2
It is not possible to tree whose preorder and postorder traversal are same. Because sequence of both are different in manner. There is only condition where preorder and postorder are same that is tree with single node.(i.e. Tree has only one node(root node))
6th Dec 2017, 5:27 PM
Ajay Gaikwad
Ajay Gaikwad - avatar
+ 1
If binary tree follows following condition then pre-order and post-order traversals of tree are same. 1. For each node in a tree, left subtree is mirror copy of right subtree and vice versa. 2. If tree is skew-symmetric tree either left skew-symmetric or right.
6th Jan 2020, 3:20 PM
Ajay Gaikwad
Ajay Gaikwad - avatar
0
It is possible in 2 cases case 1: if the tree contains single node. case 2: if the tree contains duplicates in it except in the above 2 cases post order and pre order traversals are not same
31st Oct 2018, 3:55 AM
tejaswi kanneganti
tejaswi kanneganti - avatar
0
1. A / B / C / D Inorder=DCBA POSTORDER=DCBA
13th Dec 2019, 5:07 AM
Himanshu Thakre
Himanshu Thakre - avatar