Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 1 : 4, 2, 5, 1, 6, 3 / 4, 2, 5, 1, 6, 3

Advertisement

Detailed Solution

सही उत्तर 4, 2, 5, 1, 6, 3 / 4, 2, 5, 1, 6, 3 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

A binary tree has root 1, left child 2 with children 4 and 5, and right child 3 with left child 6. Its inorder traversal is / एक बाइनरी ट्री का मूल 1 है, बायाँ शिशु 2 जिसके शिशु 4 और 5 हैं, तथा दायाँ शिशु 3 जिसका बायाँ शिशु 6 है। इसका इनऑर्डर ट्रैवर्सल है

1.
4, 2, 5, 1, 6, 3 / 4, 2, 5, 1, 6, 3
2.
1, 2, 4, 5, 3, 6 / 1, 2, 4, 5, 3, 6
3.
4, 5, 2, 6, 3, 1 / 4, 5, 2, 6, 3, 1
4.
4, 2, 5, 6, 3, 1 / 4, 2, 5, 6, 3, 1

Correct Answer: 4, 2, 5, 1, 6, 3 / 4, 2, 5, 1, 6, 3

Inorder visits the left subtree, then the root, then the right subtree; the left subtree yields 4, 2, 5, followed by root 1, followed by the right subtree 6, 3. / इनऑर्डर पहले बाएँ उपट्री, फिर मूल, फिर दाएँ उपट्री का भ्रमण करता है; बाएँ उपट्री से 4, 2, 5 मिलता है, फिर मूल 1, फिर दाएँ उपट्री से 6, 3।

Downloaded from PrepSnap (prepsnap.in)