- Thread starter
- #1

#### Joystar1977

##### Active member

- Jul 24, 2013

- 119

First Pass:

(7, 12, 5, 22, 13, 32)- Here, algorithm compares the first two elements, and swaps since 7 <12.

(7, 12, 5, 22, 13, 32)- Swap since 12 > 5.

(7, 12, 5, 22, 13, 32)- Swap since 5 < 22.

(7, 12, 5, 22, 13, 32)- Swap since 22 > 13.

(7, 12, 5, 22, 13, 32)- Now, since these elements are already in order (32 > 13), algorithm does not swap them.

Second Pass and Third Pass is done the same way.

Can someone please tell me which example is correct when bubble sorting the list of numbers?