Consider the following array 'numList':
numList 8 7 13 1 -9 4 Index 0 1 2 3 4 5
Arrange the following outputs of various passes as they occur when we apply 'Bubble sort' on the given array numList.
A. -9, 1, 4, 7, 8, 13
B. 7, 8, 1, -9, 4, 13
C. 1, -9, 4, 7, 8, 13
D. 7, 1, -9, 4, 8, 13
Consider the following array 'numList':
| numList | 8 | 7 | 13 | 1 | -9 | 4 |
|---|---|---|---|---|---|---|
| Index | 0 | 1 | 2 | 3 | 4 | 5 |
Arrange the following outputs of various passes as they occur when we apply 'Bubble sort' on the given array numList.
A. -9, 1, 4, 7, 8, 13
B. 7, 8, 1, -9, 4, 13
C. 1, -9, 4, 7, 8, 13
D. 7, 1, -9, 4, 8, 13
Solution
✅ Correct Option: 4
Bubble sort compares adjacent elements in each pass and swaps them if they are out of order, so the largest remaining element moves to the end.
Starting array: 8, 7, 13, 1, -9, 4
Pass 1: 7, 8, 1, -9, 4, 13 (B)
Pass 2: 7, 1, -9, 4, 8, 13 (D)
Pass 3: 1, -9, 4, 7, 8, 13 (C)
Pass 4: -9, 1, 4, 7, 8, 13 (A)
Related questions:
2026: 21 May Shift 1
2026: 13 May Shift 2