Sorting —
Watch every swap happen.
Sorting is the most studied family of algorithms in computer science. The difference between O(n²) and O(n log n) becomes viscerally obvious once you watch both run side by side. Run your own Python sorting code and see every comparison and swap in real time.
Why sorting algorithms matter
Sorting algorithms teach the core tradeoffs of algorithm design: time complexity, space complexity, stability, and best/worst cases. Understanding why merge sort is O(n log n) while bubble sort is O(n²) — and seeing it visually — builds the intuition to analyze any algorithm.
Why visualization changes everything
Reading about merge sort dividing and conquering is one thing. Watching your array split in half, recursion process each half, and elements merge back in sorted order is entirely different. LearnBug makes every comparison and swap visible — paste your sort code and watch it run.
Every major sorting algorithm, visualized
Merge Sort
Divide and conquer at its clearest. Watch the array split down to single elements, then merge back in sorted order — O(n log n) guaranteed.
Quick Sort
Pivot selection, partitioning, and recursive sorting. Watch elements move to their correct side of the pivot at every pass — O(n log n) average.
Bubble Sort
The simplest sort — and the most instructive about why O(n²) is slow. Watch elements bubble up to their correct position swap by swap.
Insertion Sort
Build the sorted section one element at a time. Watch each new element slide left into its correct position within the already-sorted portion.
Sorting Comparison
O(n²) vs O(n log n) in practice. Watch multiple algorithms sort the same array and see the performance gap become viscerally clear.
Run your sorting code on LearnBug
Paste your sort implementation and watch every comparison and swap execute live.