Advanced Algorithm Visualizer

Algorithm Visualizer

5 30 100
Fast 200 Slow

Algorithm Details

Time Complexity

O(n²)

Space Complexity

O(1)

Stability

Stable

Description

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 algorithm gets its name because smaller elements "bubble" to the top of the list.

Pseudocode

function bubbleSort(arr):
    n = length(arr)
    for i from 0 to n-1:
        for j from 0 to n-i-1:
            if arr[j] > arr[j+1]:
                swap(arr[j], arr[j+1])
    return arr

Algorithm Mind Map

Algorithm Performance Comparison