What is Bubble Sort?


Bubble Sort repeatedly compares adjacent elements and swaps them if they are in the wrong order.

πŸ‘‰ Bigger elements β€œbubble up” to the end of the array after every pass.

Think of it like:

Heavy bubbles rising slowly to the surface.


Step-by-Step Example

Given array:

[64, 25, 12, 22, 11]


Pass 1

Compare adjacent elements:

[25, 12, 22, 11, 64]

πŸ‘‰ Largest element 64 is now at the correct position.