The post-order traversal of a binary tree is O P Q R S T. Then possible pre-order traversal will be ________
The post-order traversal of a binary tree is O P Q R S T. Then possible pre-order traversal will be ________ Correct Answer T Q O P S R
The last, second last nodes visited in post-order traversal are root and it’s right child respectively. Option T Q R S O P can’t be a pre-order traversal, because nodes O, P are visited after the nodes Q, R, S. Option T O Q R P S, can’t be valid, because the pre-order sequence given in option T O Q R P S and given post-order traversal creates a tree with node T as root and node O as left subtree. Option T Q O P S R is valid. Option T Q O S P R is not valid as node P is visited after visiting node S.
মোঃ আরিফুল ইসলাম
Feb 20, 2025