{"title":"Engineering quicksort","authors":"S.Mansoor Sarwar , Syed Aqeel Sarwar , Mansour H.A. Jaragh , 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 < 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 ⩽ <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.