SortLab

Same input, honest measurements

Compare strategies, not animation speed.

Compare sorting algorithms on identical data using instrumented comparisons, writes, swaps, memory, stability, and scenario-based guidance.

Complexity and guarantees for all 18 lessons
AlgorithmBestAverageWorstSpaceStableIn-place
Bubble Sort O(n) O(n²) O(n²) O(1) Yes Yes
Selection Sort O(n²) O(n²) O(n²) O(1) No Yes
Insertion Sort O(n) O(n²) O(n²) O(1) Yes Yes
Gnome Sort O(n) O(n²) O(n²) O(1) Yes Yes
Cocktail Shaker Sort O(n) O(n²) O(n²) O(1) Yes Yes
Merge Sort O(n log n) O(n log n) O(n log n) O(n) Yes No
Quick Sort O(n log n) O(n log n) O(n²) O(log n) avg.; O(n) worst No Yes
Heap Sort O(n log n) O(n log n) O(n log n) O(1) No Yes
Shell Sort O(n log n) Gap-dependent O(n²) O(1) No Yes
Comb Sort O(n log n) About O(n²) O(n²) O(1) No Yes
Smoothsort O(n) O(n log n) O(n log n) O(1) No Yes
Counting Sort O(n + k) O(n + k) O(n + k) O(n + k) Yes No
Radix Sort O(d(n + b)) O(d(n + b)) O(d(n + b)) O(n + b) Yes No
Bucket Sort O(n + k) O(n + k) O(n²) O(n + k) Depends No
Timsort O(n) O(n log n) O(n log n) O(n) Yes No
Introsort O(n log n) O(n log n) O(n log n) O(log n) No Yes
Bogo Sort O(n) O(n × n!) Unbounded O(1) No Yes
Sleep Sort O(n) setup O(max value) wait Scheduler-dependent O(n) No No

The interactive comparison lab runs three algorithms on one shared deck and adds filters, scenario guidance, and a complexity-growth experiment.