Algorithms Visualized

Bubble Sort

A simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.

Untouched
Comparing
Sorted

Time Complexity

Best Case: O(n) - When the array is already sorted

Average Case: O(n²)

Worst Case: O(n²) - When the array is sorted in reverse order