Sortingintro
Bubble Sort
Repeatedly steps through the list, comparing adjacent elements and swapping them when out of order. After each pass the largest remaining element "bubbles" to its final position. Simple but quadratic.
- Best
- O(n)
- Average
- O(n²)
- Worst
- O(n²)
- Space
- O(1)
- Stable
- Yes