Question:

What will be the status of the list (given below) after pass 2 using Bubble sort? \[ 8, 7, 13, 1, -9, 4 \]

Show Hint

In Bubble sort, the largest element is placed at its correct position in each pass.
Updated On: Apr 24, 2025
  • 7, 8, 1, -9, 4, 13
  • 7, 1, -9, 4, 8, 13
  • 1, -9, 4, 7, 8, 13
  • -9, 1, 4, 7, 8, 13
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

In the first pass of Bubble sort, the largest element (13) "bubbles" to the end. After the second pass:
- The 7 and 8 are swapped.
- Then 1 and 7 are swapped, followed by 1 and -9.
- The result after pass 2 is 7, 1, -9, 4, 8, 13.
Was this answer helpful?
0
0

Questions Asked in CUET exam

View More Questions