Document Open Access Logo

Average Cost of QuickXsort with Pivot Sampling

Author Sebastian Wild

Thumbnail PDF


  • Filesize: 0.63 MB
  • 19 pages

Document Identifiers

Author Details

Sebastian Wild
  • University of Waterloo, Canada

Cite AsGet BibTex

Sebastian Wild. Average Cost of QuickXsort with Pivot Sampling. In 29th International Conference on Probabilistic, Combinatorial and Asymptotic Methods for the Analysis of Algorithms (AofA 2018). Leibniz International Proceedings in Informatics (LIPIcs), Volume 110, pp. 36:1-36:19, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2018)


QuickXsort is a strategy to combine Quicksort with another sorting method X so that the result has essentially the same comparison cost as X in isolation, but sorts in place even when X requires a linear-size buffer. We solve the recurrence for QuickXsort precisely up to the linear term including the optimization to choose pivots from a sample of k elements. This allows to immediately obtain overall average costs using only the average costs of sorting method X (as if run in isolation). We thereby extend and greatly simplify the analysis of QuickHeapsort and QuickMergesort with practically efficient pivot selection, and give the first tight upper bounds including the linear term for such methods.

Subject Classification

ACM Subject Classification
  • Theory of computation → Sorting and searching
  • in-situ sorting
  • constant-factor optimal sorting
  • pivot sampling
  • QuickMergesort
  • QuickHeapsort
  • Quicksort recurrence
  • average-case analysis


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. D. Cantone and G. Cincotti. Quickheapsort, an efficient mix of classical sorting algorithms. Theoretical Computer Science, 285(1):25-42, 2002. URL:
  2. Domenico Cantone and Gianluca Cincotti. QuickHeapsort, an efficient mix of classical sorting algorithms. In Italian Conference on Algorithms and Complexity (CIAC), pages 150-162, 2000. URL:
  3. Volker Diekert and Armin Weiß. QuickHeapsort: Modifications and improved analysis. Theory of Computing Systems, 59(2):209-230, aug 2016. URL:
  4. Ernst E. Doberkat. An average case analysis of Floyd’s algorithm to construct heaps. Information and Control, 61(2):114-131, may 1984. URL:
  5. Stefan Edelkamp and Armin Weiß. QuickXsort: Efficient sorting with n log n - 1.399 n + o(n) comparisons on average. In International Computer Science Symposium in Russia, pages 139-152. Springer, 2014. URL:
  6. Stefan Edelkamp and Armin Weiß. QuickMergesort: Practically efficient constant-factor optimal sorting, 2018. URL:
  7. Philippe Flajolet and Mordecai Golin. Mellin transforms and asymptotics. Acta Informatica, 31(7):673-696, 1994. URL:
  8. Lester R. Ford and Selmer M. Johnson. A tournament problem. The American Mathematical Monthly, 66(5):387, may 1959. URL:
  9. Viliam Geffert and Jozef Gajdoš. In-place sorting. In SOFSEM 2011: Theory and Practice of Computer Science, pages 248-259. Springer, 2011. URL:
  10. Hsien-Kuei Hwang. Limit theorems for mergesort. Random Structures and Algorithms, 8(4):319-336, jul 1996. URL:<319::aid-rsa3>;2-0.
  11. Hsien-Kuei Hwang. Asymptotic expansions of the mergesort recurrences. Acta Informatica, 35(11):911-919, 1998. URL:
  12. Jyrki Katajainen. The ultimate heapsort. In Proceedings of the Computing: The 4th Australasian Theory Symposium, Australian Computer Science Communications, pages 87-96. Springer-Verlag Singapore Pte. Ltd., 1998. URL:
  13. Jyrki Katajainen, Tomi Pasanen, and Jukka Teuhola. Practical in-place mergesort. Nordic Journal of Computing, 3(1):27-40, 1996. URL:
  14. Donald E. Knuth. The Art Of Computer Programming: Searching and Sorting. Addison Wesley, 2nd edition, 1998. Google Scholar
  15. Heikki Mannila and Esko Ukkonen. A simple linear-time algorithm for in situ merging. Information Processing Letters, 18(4):203-208, 1984. URL:
  16. Conrado Martínez and Salvador Roura. Optimal sampling strategies in Quicksort and Quickselect. SIAM Journal on Computing, 31(3):683-705, 2001. URL:
  17. Wolfgang Panny and Helmut Prodinger. Bottom-up mergesort - a detailed analysis. Algorithmica, 14(4):340-354, 1995. URL:
  18. Klaus Reinhardt. Sorting in-place with a worst case complexity of n log n - 1.3n+O(log n) comparisons and ε n log n+O(1) transports. In International Symposium on Algorithms and Computation (ISAAC), pages 489-498, 1992. URL:
  19. Salvador Roura. Divide-and-Conquer Algorithms and Data Structures. Tesi doctoral (Ph. D. thesis, Universitat Politècnica de Catalunya, 1997. Google Scholar
  20. Salvador Roura. Improved master theorems for divide-and-conquer recurrences. Journal of the ACM, 48(2):170-205, 2001. URL:
  21. Robert Sedgewick and Philippe Flajolet. An Introduction to the Analysis of Algorithms. Addison-Wesley-Longman, 2nd edition, 2013. Google Scholar
  22. Robert Sedgewick and Kevin Wayne. Algorithms. Addison-Wesley, 4th edition, 2011. Google Scholar
  23. Sebastian Wild. Dual-Pivot Quicksort and Beyond: Analysis of Multiway Partitioning and Its Practical Potential. Doktorarbeit (phd-thesis), Technische Universität Kaiserslautern, 2016. ISBN 978-3-00-054669-3. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail