Question:medium

What will be the result after pass 2 using Bubble Sort, if we are sorting elements in ascending order?
Initial List: 7 19 18 9 23 51 12 54 73

Updated On: Apr 5, 2026
  • 7, 18, 19, 9, 23, 12, 51, 54, 73
  • 7, 9, 18, 19, 23, 51, 12, 54, 73
  • 7, 9, 19, 18, 12, 23, 51, 54, 73
  • 7, 9, 18, 19, 12, 23, 51, 54, 73
Show Solution

The Correct Option is D

Solution and Explanation

To address this, Bubble Sort will be employed. This algorithm sorts by repeatedly stepping through the list, comparing adjacent elements, and swapping them if they are out of order. The process for the initial list is detailed below:

Initial List: 7, 19, 18, 9, 23, 51, 12, 54, 73

Pass 1:

  • 7 vs 19: No swap.
  • 19 vs 18: Swap. Current list: 7, 18, 19, 9, 23, 51, 12, 54, 73.
  • 19 vs 9: Swap. Current list: 7, 18, 9, 19, 23, 51, 12, 54, 73.
  • 19 vs 23: No swap.
  • 23 vs 51: No swap.
  • 51 vs 12: Swap. Current list: 7, 18, 9, 19, 23, 12, 51, 54, 73.
  • 51 vs 54: No swap.
  • 54 vs 73: No swap.

List after Pass 1: 7, 18, 9, 19, 23, 12, 51, 54, 73

Pass 2:

  • 7 vs 18: No swap.
  • 18 vs 9: Swap. Current list: 7, 9, 18, 19, 23, 12, 51, 54, 73.
  • 18 vs 19: No swap.
  • 19 vs 23: No swap.
  • 23 vs 12: Swap. Current list: 7, 9, 18, 19, 12, 23, 51, 54, 73.
  • 23 vs 51: No swap.
  • 51 vs 54: No swap.
  • 54 vs 73: No swap.

The list after Pass 2, sorted in ascending order using Bubble Sort, is: 7, 9, 18, 19, 12, 23, 51, 54, 73.

Was this answer helpful?
0


Questions Asked in CUET (UG) exam