← Back

Sorting

Algorithms that arrange elements in a specific order

Bubble Sort

Best:O(n)Avg:O(n²)Space:O(1)
comparisonin-placestable

Selection Sort

Best:O(n²)Avg:O(n²)Space:O(1)
comparisonin-placeunstable

Insertion Sort

Best:O(n)Avg:O(n²)Space:O(1)
comparisonin-placestableadaptive

Merge Sort

Best:O(n log n)Avg:O(n log n)Space:O(n)
divide-and-conquerstablenot-in-place

Quick Sort

Best:O(n log n)Avg:O(n log n)Space:O(log n)
divide-and-conquerin-placeunstable

Heap Sort

Best:O(n log n)Avg:O(n log n)Space:O(1)
comparisonin-placeunstable

Counting Sort

Best:O(n+k)Avg:O(n+k)Space:O(k)
non-comparisonstableinteger-sort

Radix Sort

Best:O(d·n)Avg:O(d·n)Space:O(n+k)
non-comparisonstableinteger-sort