Bubble Sort
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. It's easy to understand but inefficient for large datasets.
Bubble Sort Visualization
LentoRápido
Array: []
Complexity
Time Complexity:
O(n²)Space Complexity:
O(1)Pseudocode
function BubbleSort(array):
n = length(array)
for i from 0 to n-1:
for j from 0 to n-i-2:
if array[j] > array[j+1]:
swap(array[j], array[j+1])