Edit page

Bubble Sort

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order (ascending or descending arrangement). The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

This simple algorithm performs poorly in real world use and is used primarily as an educational tool. More efficient algorithms such as timsort, or merge sort are used by the sorting libraries built into popular programming languages such as Python and Java. (Source: Wikipedia)

Algorithm Visualization

Complexity

NameBestAverageWorstMemoryStableComments
Bubble sortnn2n21Yes

References

  • Geeksforgeeks
  • Wikipedia
  • YouTube
  • Programiz
  • Algomation
  • Hackerearth
  • Tutorialspoint