Sorting algorithm: Difference between revisions

Content deleted Content added
All recursive algorithms can be trivially rewritten as iterative algorithms, and vice versa. However, some algorithms are naturally well suited for recursion, and some are not.
m Fixed formatting of Thorup's algorithm, clarified that all three algorithms are integer-sorting algorithms (not just the third one), and removed final bullet which does not have any citations.
 
Line 613:
|}
Theoretical computer scientists have invented other sorting algorithms that provide better than ''O''(''n'' log ''n'') time complexity assuming certain constraints, including:
* '''Thorup's algorithm'''<ref name=":0" />, a randomized algorithm for[[integer sorting]] keys from a ___domain of finite sizealgorithm, taking {{math|''O''(''n'' log log ''n'')}} time and ''O''(''n'') space.<ref name=":0">{{Cite journal |doi=10.1006/jagm.2002.1211 |title=Randomized Sorting in O(n log log n) Time and Linear Space Using Addition, Shift, and Bit-wise Boolean Operations |journal=Journal of Algorithms |volume=42 |issue=2 |pages=205–230 |date=February 2002 |last1=Thorup |first1=M. |s2cid=9700543 |author1-link = Mikkel Thorup}}</ref>
* AHNR algorithm,<ref>{{Cite conference
| last1 = Andersson
Line 633:
| url =
| doi =
}}</ref> an [[integer sorting]] algorithm which runs in <math>O(n\log\log n)</math> time deterministically, and also has a randomized version which runs in linear time when words are large enough, specifically <math>w\ge (\log n)^{2+\varepsilon}</math> (where ''w'' is the word size).
* A randomized [[integer sorting]] algorithm taking <math>O\left(n \sqrt{\log \log n}\right)</math> expected time and ''O''(''n'') space.<ref>{{Cite conference |doi=10.1109/SFCS.2002.1181890 |title=Integer sorting in O(n√(log log n)) expected time and linear space |conference=The 43rd Annual IEEE [[Symposium on Foundations of Computer Science]] |pages=135–144 |year=2002 |first1=Yijie |last1=Han |last2=Thorup |first2=M. |author2-link = Mikkel Thorup |isbn=0-7695-1822-2}}</ref>
* One of the authors of the previously mentioned algorithm{{who|date=March 2025}} also claims to have discovered an algorithm taking <math>O\left(n \sqrt{\log n}\right)</math> time and ''O''(''n'') space, sorting real numbers,<ref>{{Cite journal |last=Han |first=Yijie |date=2020-04-01 |title=Sorting Real Numbers in $$O\big (n\sqrt{\log n}\big )$$ Time and Linear Space |url=https://doi.org/10.1007/s00453-019-00626-0 |journal=Algorithmica |language=en |volume=82 |issue=4 |pages=966–978 |doi=10.1007/s00453-019-00626-0 |issn=1432-0541}}</ref> and further claims that, without any added assumptions on the input, it can be modified to achieve <math>O\left(n \log n / \sqrt{\log \log n}\right)</math> time and ''O''(''n'') space.<!--modification seems strictly worse?-->
 
== Popular sorting algorithms ==