AlgoGlass Visualizer
World-class algorithm visualization with real-time complexity analysis and educational insights
Algorithm:
View:
Speed500ms
Array Size10
Paused | Step 1 of 0
Bubble Sort Algorithm
Keyboard Shortcuts:
SpacePlay/Pause
← →Step
HomeReset
RNew Array
FFullscreen
Bubble Sort — Code Explorer
procedure bubbleSort(array) n = length(array) for i = 0 to n-1 for j = 0 to n-i-1 if array[j] > array[j+1] swap(array[j], array[j+1]) end if end for end for end procedure
Array Visualization
Default
Comparing
Swapping
Finalized
Current Step
1
Current Step
0
Total Steps
ProgressInfinity%
Algorithm Info
Time Complexity:O(n²)
Space Complexity:O(1)
Stability:Stable
Best Case:O(n)
Worst Case:O(n²)
Average Case:O(n²)
Pseudocode
1procedure bubbleSort(array)
2 n = length(array)
3 for i = 0 to n-1
4 for j = 0 to n-i-1
5 if array[j] > array[j+1]
6 swap(array[j], array[j+1])
7 end if
8 end for
9 end for
10end procedure
Learning Insights
Current Operation
0
Sorted Elements
0
Remaining
Algorithm Characteristics
Adaptive:Yes
In-place:Yes
Online:No