Sorting Algorithm Comparisons Table

CriteriaBubbleSelectionInsertionMergeQuickCountingTimsort
TechniqueBrute forceBrute forceBrute forceDivide-and-conquerDivide-and-conquerNon comparisonHybrid
Worst TimeO(n2)O(n2)O(n2)O(nlgn)O(n2)O(k+n)O(nlgn)
Average TimeΘ(n2)Θ(n2)Θ(n2)Θ(nlgn)Θ(nlgn)Θ(k+n)Θ(nlgn)
Best TimeΩ(n)Ω(n2)Ω(n)Ω(nlgn)Ω(nlgn)Ω(k+n)Ω(n)
SpaceO(1)O(1)O(1)O(n)O(n)O(k+n)O(n)
StableYesNoYesYesNoYesYes
In-placeYesYesYesNoYesNo
OnlineNoNoYesNoNoNoNo
AdaptiveYesNoYesNoYesNoYes
Suitable forSorted listAlmost sorted listList with unknown order0<=A[i]<=k

Criteria Explanation

  • Technique: Methodology of the sorting algorithm.
  • Worst Time: Worst time complexity (Big-O) of the algorithm.
  • Average Time: Average time complexity (Big-Theta) of the algorithm.
  • Best Time: Best time complexity (Big-Omega) of the algorithm.
  • Space: Space complexity of the algorithm.
  • Stable: Stable algorithm maintains the relative order of input elements with equal values.
  • In-place: In-place algorithm does not use auxiliary data structure to transform the input elements.
  • Online: Online algorithm does not require the entire input available from the start.
  • Adaptive: Adaptive algorithm takes the advantages of presorted array elements.

Reference

Advertisement

Citation

Click to select citation style

Shovon, A. R. (2020, August 15). Sorting Algorithm Comparisons. Ahmedur Rahman Shovon. Retrieved December 3, 2024, from https://arshovon.com/blog/sorting-algorithm-comparisons/

Shovon, Ahmedur Rahman. “Sorting Algorithm Comparisons.” Ahmedur Rahman Shovon, 15 Aug. 2020. Web. 3 Dec. 2024. https://arshovon.com/blog/sorting-algorithm-comparisons/.

@misc{ shovon_2020,
    author = "Shovon, Ahmedur Rahman",
    title = "Sorting Algorithm Comparisons",
    year = "2020",
    url = "https://arshovon.com/blog/sorting-algorithm-comparisons/",
    note = "[Online; accessed 3-December-2024]"
}
Related contents in this website
Sorting Algorithm Comparisons
Previous post

Insertion Sort

Sorting Algorithm Comparisons