Algorithm Visualizer

Watch algorithms work step-by-step with beautiful animations

50
Comparisons: 0 Swaps: 0 Time: 0ms

🗺️ Pathfinding Visualizer

Click to place walls. Green = Start, Red = End. Drag them to move.

Start End Visited Path Wall

🧮 Current Algorithm Analysis

Bubble Sort

Best: O(n) Avg: O(n²) Worst: O(n²) Space: O(1) Stable ✓

Repeatedly swaps adjacent elements if they are in wrong order. Simple but inefficient for large datasets.

📚 Algorithm Complexity Reference

AlgorithmBestAverageWorstSpaceStable
Bubble SortO(n)O(n²)O(n²)O(1)✓
Selection SortO(n²)O(n²)O(n²)O(1)✗
Insertion SortO(n)O(n²)O(n²)O(1)✓
Cocktail ShakerO(n)O(n²)O(n²)O(1)✓
Merge SortO(n log n)O(n log n)O(n log n)O(n)✓
Quick SortO(n log n)O(n log n)O(n²)O(log n)✗
Heap SortO(n log n)O(n log n)O(n log n)O(1)✗
Shell SortO(n log n)O(n^1.3)O(n²)O(1)✗
Comb SortO(n log n)O(n²/2^p)O(n²)O(1)✗
Radix SortO(nk)O(nk)O(nk)O(n+k)✓
Counting SortO(n+k)O(n+k)O(n+k)O(k)✓