Pre-order traversal का सही क्रम क्या है?
What is the correct order of pre-order traversal?
- ALeft, Root, Right
- BRoot, Left, Right
- CLeft, Right, Root
- DRight, Root, Left
सही उत्तर / Answer: (B)
हल / Solution
Pre-order में पहले मूल (root) देखा जाता है, फिर पूरा बायाँ उपवृक्ष, और अंत में पूरा दायाँ उपवृक्ष — संक्षेप में यही क्रम node, बायाँ, दायाँ कहलाता है। इसी कारण pre-order क्रम का पहला अवयव हमेशा वृक्ष का मूल होता है, और हर उपवृक्ष के भीतर भी यही क्रम दोहराया जाता है। बायाँ, मूल, दायाँ वाला क्रम in-order है और बायाँ, दायाँ, मूल वाला post-order; चौथा विकल्प किसी मानक क्रम का नाम ही नहीं।
Pre-order visits the root first, then the whole left subtree, and the whole right subtree last; in short, node, left, right. That is why the first element of a pre-order sequence is always the root of the tree, and the same order repeats inside every subtree. Left, root, right is in-order, and left, right, root is post-order, while the fourth option matches no standard traversal.
