Bubble Sort Algorithm

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent components and swaps them if they are in the wrong order. More efficient algorithms such as timsort, or merge sort are used by the sorting library build into popular programming languages such as Python and Java.

Bubble Sort source code, pseudocode and analysis

The only significant advantage that bubble sort has over most other algorithms, even quicksort, but not insertion sort, is that the ability to detect that the list is sorted efficiently is build into the algorithm. Therefore, bubble sort is not a practical sorting algorithm.