47
47
22
56
6
63
3
16
12
55
79
44
74
88
71
97
6
88
22
32
52
89
78
15
What's happening
Array size24 elements
Live stats
Comparisons0
Writes0
Step0 / 0
Sorted0 / 24
Bubble Sort
Time: O(n^2)
Space: O(1)
Bubble 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 the list is sorted.
How the work grows
Same n, wildly different amounts of work.
O(n + k)
O(n log n)
O(n log² n)
O(n²)