Concept: Bubble Sort is a simple algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
Steps:
- Compare: It starts at the beginning of the array and compares the first two elements.
- Swap: If the first is greater than the second, they swap places.
- Bubble Up: This process continues to the end of the array. The largest element "bubbles up" to the correct position at the end.
- Repeat: The algorithm repeats for the remaining unsorted portion until no swaps are needed.