Question:medium

Consider the following numList:
87131-94

Sequence the following output obtained after each pass of comparison using bubble sort.
(A)
781-9413
(B)
71-94813
(C)
-9147813
(D)
1-947813
Choose the correct answer from the options given below:

Show Hint

Do each pass left to right, swapping neighbours when the left one is bigger, and write the list after each pass.
Updated On: Oct 1, 2026
  • (B), (D), (C), (A)
  • (A), (B), (C), (D)
  • (A), (B), (D), (C)
  • (C), (B), (D), (A)
Show Solution

The Correct Option is C

Solution and Explanation

Step 1: Use the idea that the biggest values settle at the right:
In every pass, the largest unsorted value moves to the end. So after pass 1 the last place holds 13. After pass 2 the last two places hold 8, 13. After pass 3 the last three hold 7, 8, 13. After pass 4 the whole list is in order.

Step 2: Test list (A):
(A) is 7, 8, 1, -9, 4, 13. It has 13 at the end and everything before is unsorted. That fits pass 1, since only one place is fixed.

Step 3: Test list (B):
(B) is 7, 1, -9, 4, 8, 13. It has 8, 13 fixed at the right end. That fits pass 2, where two places are fixed.

Step 4: Test lists (C) and (D):
(D) is 1, -9, 4, 7, 8, 13. It has 7, 8, 13 fixed at the end, which fits pass 3. (C) is -9, 1, 4, 7, 8, 13. It is fully sorted, so it is the last of the four lists.

Step 5: Check by running the passes:
Running the algorithm from 8, 7, 13, 1, -9, 4 gives exactly these four lists in the order (A), (B), (D), (C). A small program run gives the same lists.

Step 6: Compare with the options:
Only option 3 is (A), (B), (D), (C). Option 2 puts (C) before (D), which is wrong because (D) still has 1 and -9 out of order while (C) is already sorted.

Extra Check:
A quick sanity check helps. Start with the first list (A): it must keep 13 at the right end because 13 is the largest value and moves right whenever it meets a smaller one. Next, list (C) holds -9 at the left end, and -9 can reach the first place only after four passes, since it moves left one place per pass. So (C) must come after the lists where -9 is still in the third place or later.

Final Answer:
The sequence of outputs is (A), (B), (D), (C). \[ \boxed{\text{Option 3: (A), (B), (D), (C)}} \]
Was this answer helpful?
0


Questions Asked in CUET (UG) exam