🎯
Understand, Don't Memorize
Sorting algorithms teach you problem-solving patterns: loops, recursion, divide & conquer. Focus on the logic, not the code!
🎨 Visual Sorting Algorithms
64
34
25
12
22
11
90
Sorting Algorithms (5)
Selection Sort
EasyFind minimum element and swap with first position, repeat for remaining array.
StriverLeetCode
Pattern: Sorting
Bubble Sort
EasyCompare adjacent elements and swap if in wrong order. Repeat until sorted.
StriverLeetCode
Pattern: Sorting
Insertion Sort
EasyBuild sorted array one element at a time by inserting elements in correct position.
StriverLeetCode
Pattern: Sorting
Merge Sort
MediumDivide array in half recursively, then merge sorted halves.
StriverLeetCode
Pattern: Divide & Conquer
Quick Sort
MediumPick pivot, partition array around pivot, recursively sort sub-arrays.
StriverLeetCode
Pattern: Divide & Conquer
👈
Select an Algorithm
Choose a sorting algorithm to learn step-by-step
📊 Sorting Algorithms Comparison
| Algorithm | Time (Best) | Time (Average) | Time (Worst) | Space | Stable? |
|---|---|---|---|---|---|
| Selection Sort | O(n²) | O(n²) | O(n²) | O(1) | ❌ No |
| Bubble Sort | O(n) | O(n²) | O(n²) | O(1) | ✅ Yes |
| Insertion Sort | O(n) | O(n²) | O(n²) | O(1) | ✅ Yes |
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | ✅ Yes |
| Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) | ❌ No |