Algorithm Search⌘K

Comparison sorts

Problems

  • Sorting

    Put the items of a sequence in non-decreasing order by a key.

    Ω(n log n) worstintro

Algorithms

  • Insertion sort

    Sort an array one item at a time. Take the next item and move it left until the item before it is not larger.

    Θ(n²) worst · average10 languagesvisualintro
  • Merge sort

    Sort an array by divide and conquer. Sort each half, then merge the two sorted halves into one sorted array.

    Θ(n log n) worst · average · best10 languagesvisualintro