BCDEACompareAx:undefined,y:undefinedswaps: 0comparisons: 0

Bubble Sort Algorithm:

1. In an unsorted array of 5 elements, compare the first two elements to check which one is greater, and sort them in ascending order, from small to big.

2. Compare the second and third element to check which one is greater, and sort them in ascending order.

3. Compare the third and fourth element to check which one is greater, and sort them in ascending order.

4. Compare the fourth and fifth element to check which one is greater, and sort them in ascending order.

5. Repeat steps 1–4 until no more swaps are required.



Title and author:

Bubble Sort by Team YIJC
Logo

author image YIJC (Fang Fang, David, Phow Loong)