Question:medium

After two complete passes of Bubble Sort on the array [7, 2, 9, 4], what will the new order be?
A. 7
B. 2
C. 4
D. 9
Choose the correct answer from the options given below:

Show Hint

At the end of the $k$-th pass of Bubble Sort, the $k$ largest elements are guaranteed to be in their final sorted positions at the end of the array!
Here, after 2 passes, the last two elements must be 7 and 9 (represented by A and D).
Updated On: Jun 11, 2026
  • B, C, A, D
  • A, B, C, D
  • B, A, D, C
  • B, A, C, D
Show Solution

The Correct Option is A

Solution and Explanation


Step 1: Understanding the Concept:

Bubble Sort repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. One "pass" moves the largest element to the end.

Step 2: Detailed Explanation:

Initial: [7, 2, 9, 4]
Pass 1:
- Compare 7, 2: Swap -> [2, 7, 9, 4]
- Compare 7, 9: No swap -> [2, 7, 9, 4]
- Compare 9, 4: Swap -> [2, 7, 4, 9]
Pass 2:
- Compare 2, 7: No swap -> [2, 7, 4, 9]
- Compare 7, 4: Swap -> [2, 4, 7, 9]
- Compare 7, 9: No swap -> [2, 4, 7, 9]
Order is now 2 (B), 4 (C), 7 (A), 9 (D).

Step 3: Final Answer:

The order is 2, 4, 7, 9, which corresponds to B, C, A, D.
Was this answer helpful?
0


Questions Asked in CUET (UG) exam