Question

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

Option 2 : 40 30 15 10 20 / 40 30 15 10 20

Advertisement

Detailed Solution

सही उत्तर 40 30 15 10 20 / 40 30 15 10 20 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

A max-heap is built by successively inserting 10, 20, 15, 30, 40 into an empty heap. The final array representation is: / खाली हीप में 10, 20, 15, 30, 40 क्रमिक रूप से प्रविष्ट करके मैक्स-हीप बनाई जाती है। अंतिम ऐरे निरूपण है:

1.
40 30 20 15 10 / 40 30 20 15 10
2.
40 30 15 10 20 / 40 30 15 10 20
3.
10 20 15 30 40 / 10 20 15 30 40
4.
40 20 30 10 15 / 40 20 30 10 15

Correct Answer: 40 30 15 10 20 / 40 30 15 10 20

Insert 10 → [10]; 20 → [20,10]; 15 → [20,10,15]; 30 → [30,20,15,10]; 40 lands under 20, bubbles past 20, then past 30 → [40,30,15,10,20]. / 10 प्रविष्ट → [10]; 20 → [20,10]; 15 → [20,10,15]; 30 → [30,20,15,10]; 40, 20 के नीचे आता है, 20 से ऊपर फिर 30 से ऊपर उठता है → [40,30,15,10,20]।

Downloaded from PrepSnap (prepsnap.in)