Question

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

Option 3 : 20 40 50 60 70 80 / 20 40 50 60 70 80

Advertisement

Detailed Solution

सही उत्तर 20 40 50 60 70 80 / 20 40 50 60 70 80 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

In the BST built above (keys 50, 30, 70, 20, 40, 60, 80), node 30 is deleted using the inorder-successor replacement strategy. The inorder traversal after deletion is: / ऊपर निर्मित BST (की 50, 30, 70, 20, 40, 60, 80) में इनऑर्डर-उत्तरवर्ती प्रतिस्थापन रणनीति से नोड 30 हटाया जाता है। हटाने के बाद इनऑर्डर भ्रमण है:

1.
20 30 40 50 60 70 80 / 20 30 40 50 60 70 80
2.
20 40 50 60 70 80 30 / 20 40 50 60 70 80 30
3.
20 40 50 60 70 80 / 20 40 50 60 70 80
4.
40 20 50 60 70 80 / 40 20 50 60 70 80

Correct Answer: 20 40 50 60 70 80 / 20 40 50 60 70 80

Node 30 has two children; its inorder successor is 40, which takes 30's place while 40's original position is removed. Inorder remains sorted: 20 40 50 60 70 80. / नोड 30 के दो संतान हैं; इसका इनऑर्डर उत्तरवर्ती 40 है, जो 30 का स्थान लेता है जबकि 40 की मूल स्थिति हट जाती है। इनऑर्डर क्रमबद्ध रहता है: 20 40 50 60 70 80।

Downloaded from PrepSnap (prepsnap.in)