← Back to Categories

🔄 Sorting Techniques

Master all sorting algorithms with visualizations

🎯

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

Easy

Find minimum element and swap with first position, repeat for remaining array.

StriverLeetCode
Pattern: Sorting

Bubble Sort

Easy

Compare adjacent elements and swap if in wrong order. Repeat until sorted.

StriverLeetCode
Pattern: Sorting

Insertion Sort

Easy

Build sorted array one element at a time by inserting elements in correct position.

StriverLeetCode
Pattern: Sorting

Merge Sort

Medium

Divide array in half recursively, then merge sorted halves.

StriverLeetCode
Pattern: Divide & Conquer

Quick Sort

Medium

Pick 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

AlgorithmTime (Best)Time (Average)Time (Worst)SpaceStable?
Selection SortO(n²)O(n²)O(n²)O(1)❌ No
Bubble SortO(n)O(n²)O(n²)O(1)✅ Yes
Insertion SortO(n)O(n²)O(n²)O(1)✅ Yes
Merge SortO(n log n)O(n log n)O(n log n)O(n)✅ Yes
Quick SortO(n log n)O(n log n)O(n²)O(log n)❌ No