I Help You
Programming

Sorting Algorithms

Sorting algorithms arrange the items in a list into an order, such as numbers from smallest to largest or names alphabetically. Sorted data is easier to search, compare and display, so sorting is one of the most common tasks in programming.

Simple algorithms such as bubble sort, selection sort and insertion sort take O(n²) time and suit small lists. Faster algorithms such as merge sort, quick sort and heap sort take O(n log n) time. A sort is stable when equal items keep their original order. Built-in sorts, such as Python's Timsort, combine techniques for speed on real data.

Try the related tools