Visualize, Understand, Compare, and Execute

Interactive Sorting Algorithm Visualizer

Step 1 Algorithm & View
Step 2 Manual Data
Step 3 Color Palette & Styling
DefaultCompareSwapSorted
Step 4 Execution & Speed
Speed: 20%475ms/step
Comparisons: 0Swaps/Writes: 0Time: 0.00sDelay: 475msAlgorithm: Bubble SortView: HISTOGRAM
Ready to sort.
250
188
125
63
0

Bubble Sort — Deep Academic Overview

Bubble Sort is a classical comparison-based algorithm that operates by repeatedly traversing the input sequence and swapping adjacent out-of-order elements. In each pass, the largest unplaced element 'bubbles' up to its final correct position at the right boundary. While simple to conceptualize, its quadratic asymptotic performance O(n²) makes it inefficient for large datasets. However, with an early-exit optimization flag (checking if any swaps occurred in a pass), it achieves linear O(n) performance on pre-sorted arrays, demonstrating adaptive behavior.

Category: Basic Comparison-BasedBest: O(n)Worst: O(n²)Space: O(1)Stable SortIn-Place