What will be the result after second pass of bubble sort for an unsorted list given as follows?
[8,7,13,1,-9,4]
What will be the result after second pass of bubble sort for an unsorted list given as follows?
[8,7,13,1,-9,4]
Solution
✅ Correct Option: 2
Each pass compares adjacent pairs from the left and swaps them if they are out of order, so the largest remaining element moves to the end.
| Pass | Swaps made | List after the pass |
|---|---|---|
| 1 | ; ; ; | [7,8,1,-9,4,13] |
| 2 | ; ; | [7,1,-9,4,8,13] |
In pass 2, the pair is already in order, so there is no swap there.
Option 1: this is the list after the first pass, not the second.
Options 3 and 4: these need three or more passes, so they are too far along.
Related questions:
2025: 16 May Shift 1
2026: 31 May Shift 1
2025: 14 May Shift 1
2025: 3 June Shift 2
2026: 23 May Shift 2