Sorting Algorithm Visualizer

Current Element
Compared
Swapped
Sorted
Pivot
Group 1
Group 2

Array Visualization

Algorithm State

Current Indices
-
Comparisons
0
Swaps
0
Current Operation
Waiting to start...

Memory State

Variables
i:
-
j:
-
min/max index:
-
pivot:
-
Algorithm Specific
No algorithm selected
-
Time & Space Complexity
Time Complexity:
-
Space Complexity:
-
Current Space:
-

Algorithm Code

// Select an algorithm to see its code

Algorithm Step

Select an algorithm and click visualize to see the explanation of each step.

Step 0 of 0

Sorting Results

Comparisons
0
Elements compared
Swaps
0
Elements swapped
Time Efficiency
O(n²)
Worst-case time complexity
Space Usage
O(1)
Auxiliary space complexity

Sort Summary

Algorithm Comparison

Algorithm Worst-Case Time Average-Case Time Best-Case Time Space Complexity Stable
Bubble Sort O(n²) O(n²) O(n) O(1) Yes
Insertion Sort O(n²) O(n²) O(n) O(1) Yes
Selection Sort O(n²) O(n²) O(n²) O(1) No
Merge Sort O(n log n) O(n log n) O(n log n) O(n) Yes
Quick Sort O(n²) O(n log n) O(n log n) O(log n) No
Heap Sort O(n log n) O(n log n) O(n log n) O(1) No
Radix Sort O(nk) O(nk) O(nk) O(n+k) Yes
Counting Sort O(n+k) O(n+k) O(n+k) O(k) Yes
Bucket Sort O(n²) O(n) O(n) O(n+k) Yes
Shell Sort O(n log² n) O(n log n) O(n log n) O(1) No