Bubble Sort Visualization

Repeatedly stepping through the list, comparing adjacent elements and swapping them if they are in the wrong order.

Step: 0 / -1
Speed

Pseudocode

1for i = 0 to n-1
2 for j = 0 to n-i-1
3 if arr[j] > arr[j+1]
4 swap(arr[j], arr[j+1])

Time Complexity

Best CaseO(n)
Average CaseO(n²)
Worst CaseO(n²)