Bubble Sort
SortingEasyRepeatedly swap adjacent elements if they are in the wrong order.
Alt+Shift+B
Configuration Panel
Pass / Swapping Trace Visualizer
230
81
562
123
384
55
726
167
Step: 1 / 1
Time Complexity
O(N^2) average/worst, O(N) best case optimized
Space Complexity
O(1) auxiliary memory
Conceptual Overview
Bubble Sort repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. This pass is repeated until the list is sorted.
Algorithm Idea
Run nested loops. Compare adjacent cells: if left > right, swap. After each inner loop pass, the largest unsorted element bubbles up to the end.
Stable Sorting
Stable (adjacent equal values do not swap)
In-place Memory
In-place (no auxiliary array required)
Source: CP-Algorithms search & sorting reference