Question:

Arrange the following in order related to bubble sort for a list of elements: Initial list: \[4, -9, 12, 30, 2, 6\] (A) \[4, -9, 12, 30, 2, 6\]
(B) \[-9, 4, 12, 30, 2, 6\]
(C) \[-9, 4, 12, 2, 30, 6\]
(D) \[-9, 4, 12, 2, 6, 30\]

Show Hint

In bubble sort, the largest element is placed at the end of the list after each pass.
Updated On: Sep 18, 2025
  • (A), (B), (D), (C)
  • (A), (C), (B), (D)
  • (B), (A), (D), (C)
  • (C), (B), (D), (A)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Bubble sort principle.
In bubble sort, the largest element bubbles to the last position after each pass by successive swaps.
Step 2: Trace passes.
- Start (A): \[4, -9, 12, 30, 2, 6\]
- Pass 1: Swap 4 and -9 → (B): \[-9, 4, 12, 30, 2, 6\]
- Next swaps move 2 and 6 before 30 → (D): \[-9, 4, 12, 2, 6, 30\]
- Then bubble sort continues and swaps 2 with 12 → (C): \[-9, 4, 12, 2, 30, 6\] (intermediate).
Step 3: Correct sequence.
Hence correct ordering is: (A) → (B) → (D) → (C).
Final Answer: \[ \boxed{(A), (B), (D), (C)} \]
Was this answer helpful?
0
0

Questions Asked in CUET exam

View More Questions