Sorting Algorithm Visualizer
An interactive sandbox exploring sorting algorithms. Control the speed and step-through, analyze complexities, read the corresponding pseudocode, and listen to the audio feedback.
Bubble Sort (Live Canvas)
Comparisons0
Operations0
Step0/0
No array data generated
STARTPROGRESS SCRUBBERSORTED
Delay80ms
Size40
Select Algorithm
Pseudocode Trace
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])
Algorithm Analysis
Repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. It is a stable, simple comparison-based sort.
Best TimeO(n)
Average TimeO(n²)
Worst TimeO(n²)
Worst SpaceO(1)
Stable Sort?Yes