Question

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

Option 4 : [1, 2, 4, 5, 8] / [1, 2, 4, 5, 8]

Advertisement

Detailed Solution

सही उत्तर [1, 2, 4, 5, 8] / [1, 2, 4, 5, 8] है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

After the second pass of bubble sort (ascending) on [5, 1, 4, 2, 8], the array is: / [5, 1, 4, 2, 8] पर बबल सॉर्ट (आरोही) के दूसरे पास के बाद ऐरे है:

1.
[1, 4, 2, 5, 8] / [1, 4, 2, 5, 8]
2.
[1, 2, 4, 8, 5] / [1, 2, 4, 8, 5]
3.
[1, 2, 5, 4, 8] / [1, 2, 5, 4, 8]
4.
[1, 2, 4, 5, 8] / [1, 2, 4, 5, 8]

Correct Answer: [1, 2, 4, 5, 8] / [1, 2, 4, 5, 8]

Pass 1 bubbles the largest to the end: [1,4,2,5,8]. Pass 2 scans the first four: 1,4 stay; 4,2 swap; 4,5 stay → [1,2,4,5,8]. / पास 1 सबसे बड़े को अंत में पहुँचाता है: [1,4,2,5,8]। पास 2 पहले चार को स्कैन करता है: 1,4 स्थिर; 4,2 अदला-बदली; 4,5 स्थिर → [1,2,4,5,8]।

Downloaded from PrepSnap (prepsnap.in)