Skip to content

Latest commit

History

History
25 lines (18 loc) 路 1.1 KB

File metadata and controls

25 lines (18 loc) 路 1.1 KB

Bubble Sort

Read this in other languages: Portugu锚s

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.

Algorithm Visualization

Complexity

Name Best Average Worst Memory Stable Comments
Bubble sort n n2 n2 1 Yes

References