Visualisation
Dark Mode
Comparing
Sorted
Bubble sort works by repeatedly swapping adjacent elements if they are in the wrong order. The largest element passes through to the end of the list, and this repeats until all elemnts are sorted.
Worst Case Time Complexity | O(n^2) |
Best Case Time Complexity | O(n) |
Average Time Complexity | O(n^2) |