Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 773 Bytes

File metadata and controls

14 lines (9 loc) · 773 Bytes

Bubble Sort

Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

It is named because elements tend to move up into the correct order like bubbles rising to the surface.

Complexity

Best Average Worst Space (Memory) Stable Advantage
O(n) O(n2) O(n2) O(1) Yes Simplicity