Sorting Visualizer
Visualize and compare sorting algorithms with step-by-step animation
Bubble Sort
Repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.
Best Case
O(n)
Average Case
O(n²)
Worst Case
O(n²)
Space
O(1)
Visualization
Sort Results
190
Total Comparisons
68
Total Swaps
259
Total Steps
20
Array Size
Color Legend
Default
Comparing
Swapping
Sorted
Pivot
Time Complexity Reference
Bubble Sort: O(n) best, O(n²) average/worst
Selection Sort: O(n²) all cases
Insertion Sort: O(n) best, O(n²) average/worst
Quick Sort: O(n log n) best/average, O(n²) worst
Merge Sort: O(n log n) all cases
About Sorting Visualizer
Visualize how different sorting algorithms work step by step. Compare their efficiency through comparisons, swaps, and time complexity.
Sorting Algorithms
- Bubble Sort: Simple comparison-based sort, good for learning
- Selection Sort: Finds minimum repeatedly, O(n²) always
- Insertion Sort: Efficient for small/nearly sorted arrays
- Quick Sort: Divide and conquer with pivots, very fast in practice
- Merge Sort: Stable O(n log n) with extra space requirement
Related Tools
Number Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal systems
Long Division Solver
Solve long division problems with step-by-step solutions
Multiplication Table Generator
Generate and print multiplication tables
Probability Simulator
Simulate coin flips, dice rolls, and card draws with statistical analysis