Home

Sorting Algorithms

Seven sorting algorithms, one page each. Every page runs its algorithm step by step on an array you can reshape, and races it against the other six on the same values.

  • O(n²)

    Bubble sort

    Swap neighbours until nothing is out of order.

  • O(n²)

    Insertion sort

    Build a sorted prefix, one value at a time.

  • O(n²)

    Selection sort

    Find the smallest, put it in front, repeat.

  • ≈O(n^1.25)

    Shell sort

    Insertion sort over shrinking gaps.

  • O(n log n)

    Merge sort

    Split to single elements, then merge in order.

  • O(n log n)

    Quicksort

    Partition around a pivot, then sort the sides.

  • O(n log n)

    Heapsort

    Build a heap, then pull the maximum off it n times.

Developed by Akif Akkaya