🧮 Sorting Algorithms

Sorting algorithms are fundamental to computer science. Each bar represents an element; its height is its value. Coloured bars mark currently compared or swapped elements while the algorithm runs. Choose an algorithm, shuffle the array, then sort to compare behaviour and complexity in action. 🇺🇦 Українська

Algorithm

Array

Speed

Comparisons0
Swaps/Writes0
StatusReady

Algorithm Complexity

Algorithm Best Average Worst Space Stable
Bubble O(n) O(n²) O(n²) O(1) Yes
Insertion O(n) O(n²) O(n²) O(1) Yes
Selection O(n²) O(n²) O(n²) O(1) No
Merge O(n log n) O(n log n) O(n log n) O(n) Yes
Heap O(n log n) O(n log n) O(n log n) O(1) No
Quick O(n log n) O(n log n) O(n²) O(log n) No