Sorting
Last updated
Last updated
The fastest possible algorithm that uses comparisons to sort items must use time.
Sort algorithms such as insertion sort, selection sort & bubble sort are relatively simple but slow.
Their simplicity sometimes lets them outperform faster but more complicated algorithms for very small arrays.
Such as heap sort, quick sort, and merge sort, are more complicated but much faster.
Sorting algorithms such as as counting sort and pigeonhole sort, don't use comparisons to sort items, so they can break the barrier and perform amazingly fast under the right circumstances.