Sorting Algorithms

Visualize how different sorting algorithms work step by step

Configure input and click Visualize to start

Input Data

Step 0of 0
Speed×5
SlowFast

Complexity

Best
O(n)
Average
O(n²)
Worst
O(n²)
Space
O(1)
✓ Stable
Pseudocode
01for i = 0 to n-1:
02 for j = 0 to n-i-1:
03 if arr[j] > arr[j+1]:
04 swap(arr[j], arr[j+1])
05 if no swap: break // optimized