Bubble sort
Updated: 06/22/2024 by Computer Hope
Bubble sort is a simple sorting technique that processes adjacent items in a list, compares them, and if necessary reorders them by swapping their positions in the list. It repeats this process for the whole list until it can complete a full pass without making any changes.
The algorithm is called Bubble sort because items "bubble" further down the list until their order is correct. Bubble sort is simple to implement, but not very efficient: its worst-case (and average) complexity is O(n²), where n is the number of items being sorted. If you perform Bubble sort on a list of 10 items, at most 100 operations are required to sort the list.