Sorting algorithms, visualized

    Sorting is where Big-O stops being abstract: the same input takes visibly different numbers of steps. Step through each one on your own array.

    Bubble and selection sort show the idea; merge and quick sort are what interviews ask about; counting and radix sort show how to beat comparison sorting.

    Simple comparison sorts

    Quadratic, but the clearest way to see what sorting does.

    Divide and conquer

    The O(n log n) sorts used in practice.

    Non-comparison sorts

    Linear time when the keys allow it.

    Learn it as part of a path

    Related topics