ChoralSoft Learn
Sorting algorithms compared
Same data, five algorithms. See how the work differs, and why n log n beats n squared.
Sorting algorithms, side by side
Choose an algorithm, shuffle the bars, and watch how many comparisons and writes each one needs for the very same input.
Unsorted. Press Play or Step.
Comparisons: 0 Writes: 0
Insertion sort: O(n²) time (O(n) if nearly sorted), O(1) space, stable. Grows a sorted prefix by inserting each new item where it belongs. Great for small or nearly-sorted data.
Go deeper
- Article: Merge intervals, sort first then sweep
- Article: Heaps and priority queues
- Cheat sheet: sorting algorithms compared
- Book: Algorithms Made Simple
More explainers: Learn hub · Printable cheat sheets · Learning paths
