CS Fundamentals

🏎️ Sorting Algorithm Arena

Race sorting algorithms head-to-head. Watch every comparison and swap in real time.


Array Preset

Speed

Algorithms (select 1 or 2)

Bubble Sort

Step 0 / 0

Ready to race


How It Works

Bubble Sort

Repeatedly swaps adjacent elements if they are in the wrong order.

Best: O(n)Avg: O(n²)Space: O(1)
Selection Sort

Finds the minimum element and places it at the beginning.

Best: O(n²)Avg: O(n²)Space: O(1)
Insertion Sort

Builds sorted array one element at a time by inserting into correct position.

Best: O(n)Avg: O(n²)Space: O(1)
Merge Sort

Divides array in half, recursively sorts, then merges.

Best: O(n log n)Avg: O(n log n)Space: O(n)
Quick Sort

Picks a pivot and partitions elements around it.

Best: O(n log n)Avg: O(n log n)Space: O(log n)
Heap Sort

Builds a max-heap and repeatedly extracts the maximum.

Best: O(n log n)Avg: O(n log n)Space: O(1)

Unsorted

Comparing

Swapping

Sorted

Pivot


© 2026 Adam Hultman