Average Case and Distributional Analysis of Dual-Pivot Quicksort

Author:

Wild Sebastian1,Nebel Markus E.1,Neininger Ralph2

Affiliation:

1. University of Kaiserslautern, Kaiserslautern

2. J. W. Goethe University, Frankfurt am Main

Abstract

In 2009, Oracle replaced the long-serving sorting algorithm in its Java 7 runtime library by a new dual-pivot Quicksort variant due to Vladimir Yaroslavskiy. The decision was based on the strikingly good performance of Yaroslavskiy's implementation in running time experiments. At that time, no precise investigations of the algorithm were available to explain its superior performance—on the contrary: previous theoretical studies of other dual-pivot Quicksort variants even discouraged the use of two pivots. In 2012, two of the authors gave an average case analysis of a simplified version of Yaroslavskiy's algorithm, proving that savings in the number of comparisons are possible. However, Yaroslavskiy's algorithm needs more swaps, which renders the analysis inconclusive. To force the issue, we herein extend our analysis to the fully detailed style of Knuth: we determine the exact number of executed Java Bytecode instructions. Surprisingly, Yaroslavskiy's algorithm needs sightly more Bytecode instructions than a simple implementation of classic Quicksort—contradicting observed running times. As in Oracle's library implementation, we incorporate the use of Insertionsort on small subproblems and show that it indeed speeds up Yaroslavskiy's Quicksort in terms of Bytecodes; but even with optimal Insertionsort thresholds, the new Quicksort variant needs slightly more Bytecode instructions on average. Finally, we show that the (suitably normalized) costs of Yaroslavskiy's algorithm converge to a random variable whose distribution is characterized by a fixed-point equation. From that, we compute variances of costs and show that for large n , costs are concentrated around their mean.

Publisher

Association for Computing Machinery (ACM)

Subject

Mathematics (miscellaneous)

Reference41 articles.

1. Engineering a sort function

2. Continuous Bytecode Instruction Counting for CPU Consumption Estimation

3. Transitional behaviors of the average cost of quicksort with median-of-(2t + 1)

4. Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest and Clifford Stein. 2009. Introduction to Algorithms (3rd ed.). MIT Press. Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest and Clifford Stein. 2009. Introduction to Algorithms (3rd ed.). MIT Press.

5. Herbert A. David and Haikady N. Nagaraja. 2003. Order Statistics (3rd ed.). Wiley-Interscience. Herbert A. David and Haikady N. Nagaraja. 2003. Order Statistics (3rd ed.). Wiley-Interscience.

Cited by 9 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. Fast continuous streaming sort in big streaming data environment under fixed-size single storage;PLOS ONE;2022-04-05

2. Scalable Text Index Construction;Lecture Notes in Computer Science;2022

3. BlockQuicksort;ACM Journal of Experimental Algorithmics;2019-12-17

4. New and improved search algorithms and precise analysis of their average-case complexity;Future Generation Computer Systems;2019-06

5. Dual-Pivot Quicksort: Optimality, Analysis and Zeros of Associated Lattice Paths;Combinatorics, Probability and Computing;2018-08-14

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3