A bubble sort is a simple sorting algorithm that repeatedly steps through a list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.
The pass through the list is repeated until no swaps are needed, indicating the list is sorted. Sometimes referred to as a sinking sort.
🔔 Complexity is considered in terms of worst case.
Notes | |
---|---|
Θ(n2) |
Notes | |
---|---|
Θ(1) | The sorting operations take place on the unsorted array |