Arrange the following steps in order for bubble sorting:
(A) Compare the adjacent elements.
(B) List is sorted.
(C) Take an unsorted list.
(D) Swap the elements.
Arrange the following steps in order for bubble sorting:
(A) Compare the adjacent elements.
(B) List is sorted.
(C) Take an unsorted list.
(D) Swap the elements.
Solution
✅ Correct Option: 2
(C) Take an unsorted list.
(A) Compare the adjacent elements.
(D) Swap the elements if they are in the wrong order.
(B) List is sorted.
Steps (A) and (D) repeat for every pass until no swaps are needed, and only then is the list sorted.
Option 1: declares the list sorted before the swaps that sort it are done.
Related questions:
2026: 29 May Shift 2
2026: 21 May Shift 1
2026: 24 May Shift 1
2026: 20 May Shift 1