Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 1 : 40, 30, 15, 10, 20
Advertisement
Detailed Solution
सही उत्तर 40, 30, 15, 10, 20 है।
Key Points
Helpful?
Question:
The keys 10, 20, 15, 30, 40 are inserted in order into an initially empty max-heap. What is the final array representation of the heap? / कुंजियाँ 10, 20, 15, 30, 40 क्रम से प्रारंभ में खाली max-heap में डाली जाती हैं। हीप का अंतिम ऐरे निरूपण क्या है?
1.
40, 30, 15, 10, 20
2.
30, 40, 15, 20, 10
3.
40, 20, 30, 10, 15
4.
30, 20, 15, 10, 40
Correct Answer: 40, 30, 15, 10, 20
Insertions with bubble-up give: [10], then [20, 10], then [20, 10, 15], then 30 bubbles past 10 and 20 to give [30, 20, 15, 10], and finally 40 bubbles past 20 and 30 to give [40, 30, 15, 10, 20]. / बबल-अप के साथ निवेशन से: [10], फिर [20, 10], फिर [20, 10, 15], फिर 30, 10 और 20 से ऊपर जाकर [30, 20, 15, 10] देता है, और अंत में 40, 20 और 30 से ऊपर जाकर [40, 30, 15, 10, 20] देता है।
Downloaded from PrepSnap (prepsnap.in)