Overview
Bubble Sort walks through the list many times, moving larger values toward the end one swap at a time.
Sorts a list by repeatedly swapping neighboring items that are out of order.
Compact metadata for implementation and discovery.
Bubble Sort walks through the list many times, moving larger values toward the end one swap at a time.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n)
Average
O(n^2)
Worst
O(n^2)
Space
O(1)
Show adjacent items swapping while larger values drift to the end.
Bubble Sort operates in O(n^2) time and O(1) space within the Exchange Sort family. Often compared with Insertion Sort and Selection Sort.
What each reference supports for this entry.
Textbook support for Bubble Sort invariants, recurrences, relaxation rules, or asymptotic analysis.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Bubble sort and insertion sort are simple stable quadratic sorts with different local-movement behavior.