Engineering quicksort

S.Mansoor Sarwar , Syed Aqeel Sarwar , Mansour H.A. Jaragh , Jesse Brandeburg
{"title":"Engineering quicksort","authors":"S.Mansoor Sarwar ,&nbsp;Syed Aqeel Sarwar ,&nbsp;Mansour H.A. Jaragh ,&nbsp;Jesse Brandeburg","doi":"10.1016/0096-0551(96)00005-7","DOIUrl":null,"url":null,"abstract":"<div><p>This paper describes the results of a large empirical study to measure the run-time behavior of Quicksort by using various methods of computing the pivot element for medium to large size randomly generated integer data. The results of our study contradict the common notion that Quicksort gives best performance if median of three scheme is used to compute the pivot element and array partitions having &lt; 10 elements are sorted by using insertion sort. It was found that Quicksort performs best when median of three scheme is used to decide the pivot element and arrays with &lt; 4 elements are hand sorted. Our method gives an average speedup of &gt; 9% when compared to the method with a cutoff of 10 and sub-arrays with &lt; 10 elements insertion sorted for 1000 ⩽ <em>N</em> 1.5 × 10<sup>6</sup>. Our study shows that advanced hardware features allow for implementation of very fast codes for sorting small arrays, and using such codes instead of insertion sort can lead to substantial improvements for Quicksort, as conjectured by Sedgewick many years ago.</p></div>","PeriodicalId":100315,"journal":{"name":"Computer Languages","volume":"22 1","pages":"Pages 39-47"},"PeriodicalIF":0.0000,"publicationDate":"1996-04-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://sci-hub-pdf.com/10.1016/0096-0551(96)00005-7","citationCount":"14","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computer Languages","FirstCategoryId":"1085","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/0096055196000057","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 14

Abstract

This paper describes the results of a large empirical study to measure the run-time behavior of Quicksort by using various methods of computing the pivot element for medium to large size randomly generated integer data. The results of our study contradict the common notion that Quicksort gives best performance if median of three scheme is used to compute the pivot element and array partitions having < 10 elements are sorted by using insertion sort. It was found that Quicksort performs best when median of three scheme is used to decide the pivot element and arrays with < 4 elements are hand sorted. Our method gives an average speedup of > 9% when compared to the method with a cutoff of 10 and sub-arrays with < 10 elements insertion sorted for 1000 ⩽ N 1.5 × 106. Our study shows that advanced hardware features allow for implementation of very fast codes for sorting small arrays, and using such codes instead of insertion sort can lead to substantial improvements for Quicksort, as conjectured by Sedgewick many years ago.

工程快速排序
本文描述了一项大型实证研究的结果,该研究通过使用各种计算中大型随机生成的整数数据的枢轴元素的方法来测量快速排序的运行时行为。我们的研究结果与通常的观念相矛盾,即如果使用三种方案的中位数来计算主元素和具有<使用插入排序对10个元素排序。结果表明,采用三种方案的中位数来确定主元素和带<的数组时,快速排序效果最好;4个元素是手工排序的。我们的方法给出的平均加速为>与截止值为10的方法和带有<10个元素插入排序为1000≤N 1.5 × 106。我们的研究表明,先进的硬件特性允许实现非常快的代码来对小数组进行排序,并且使用这些代码代替插入排序可以导致快速排序的实质性改进,正如Sedgewick多年前所推测的那样。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信