{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,8,21]],"date-time":"2026-08-21T18:39:33Z","timestamp":1787337573582,"version":"build-2736575974"},"reference-count":27,"publisher":"Society for Industrial & Applied Mathematics (SIAM)","issue":"3","content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["SIAM J. Comput."],"published-print":{"date-parts":[[2001,1]]},"abstract":"<jats:p>It is well known that the performance of quicksort can be improved by selecting the median of a sample of elements as the pivot of each partitioning stage. For large samples the partitions are better, but the amount of additional comparisons and exchanges to find the median of the sample also increases. We show in this paper that the optimal sample size to minimize the average total cost of quicksort, as a function of the size n of the current subarray size, is $a\\cdot \\sqrt{n} + o(\\sqrt{n}\\,)$. We give a closed expression for a, which depends on the selection algorithm and the costs of elementary comparisons and exchanges. Moreover, we show that selecting the medians of the samples as pivots is not the best strategy when exchanges are much more expensive than comparisons. We also apply the same ideas and techniques to the analysis of quickselect and get similar results.<\/jats:p>","DOI":"10.1137\/s0097539700382108","type":"journal-article","created":{"date-parts":[[2003,6,11]],"date-time":"2003-06-11T11:12:06Z","timestamp":1055329926000},"page":"683-705","source":"Crossref","is-referenced-by-count":47,"title":["Optimal Sampling Strategies in Quicksort and Quickselect"],"prefix":"10.1137","volume":"31","author":[{"given":"Conrado","family":"Mart\u00ednez","sequence":"first","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Salvador","family":"Roura","sequence":"additional","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"351","published-online":{"date-parts":[[2012,2,17]]},"reference":[{"key":"R1","unstructured":"M. Abramowitz and I. Stegun, eds.\n                      Handbook of Mathematical Functions\n                      , Dover, New York, 1964."},{"key":"R2","unstructured":"J. Bentley,\n                      Programming Pearls\n                      , Addison\u2010Wesley, Reading, MA, 1986."},{"key":"R3","doi-asserted-by":"publisher","DOI":"10.1002\/spe.4380231105"},{"key":"R4","doi-asserted-by":"publisher","DOI":"10.1145\/360680.360691"},{"key":"R5","unstructured":"Ronald Graham, Donald Knuth, Oren Patashnik, Matematyka konkretna, Wydawnictwo Naukowe PWN, Warsaw, 1998, 719\u20130, Translated from the second English (1994) edition by P. Chrz\u0105stowski, A. Czumaj, L. G\u0105sieniec and M. Raczunas99m:68002"},{"key":"R6","doi-asserted-by":"publisher","DOI":"10.1051\/ita:1999112"},{"key":"R7","doi-asserted-by":"publisher","DOI":"10.1145\/366622.366644"},{"key":"R8","doi-asserted-by":"publisher","DOI":"10.1093\/comjnl\/5.1.10"},{"key":"R9","doi-asserted-by":"publisher","DOI":"10.1017\/S0963548397003325"},{"key":"R10","doi-asserted-by":"publisher","DOI":"10.1002\/(SICI)1098-2418(199701\/03)10:1\/2<143::AID-RSA7>3.0.CO;2-V"},{"key":"R11","unstructured":"Donald Knuth, Mathematical analysis of algorithms, North\u2010Holland, Amsterdam, 1972, 19\u20132753:7122"},{"key":"R12","volume-title":"The art of computer programming. Volume 3","author":"Knuth Donald","year":"1973"},{"key":"R13","unstructured":"H. Mahmoud,\n                      Sorting: A Distribution Theory\n                      , John Wiley and Sons, New York, 2000."},{"key":"R14","doi-asserted-by":"publisher","DOI":"10.1051\/ita\/1995290402551"},{"key":"R15","unstructured":"Conrado Mart\u00ednez, Salvador Roura, Optimal sampling strategies in quicksort, Lecture Notes in Comput. Sci., Vol. 1443, Springer, Berlin, 1998, 327\u201333899m:68038"},{"key":"R16","unstructured":"C. Mart\u00ednez and S. Roura,\n                      Optimal Sampling Strategies in Quicksort and Quickselect\n                      , Tech. Rep. LSI\u201098\u20101\u2010R, LSI\u2010UPC, 1998;"},{"key":"R16","unstructured":"also available online from www.lsi.upc.es\/dept\/techreps\/1998.html."},{"key":"R17","doi-asserted-by":"publisher","DOI":"10.1002\/rsa.3240070403"},{"key":"R18","unstructured":"Alois Panholzer, Helmut Prodinger, A generating functions approach for the analysis of grand averages for multiple QUICKSELECT, Proceedings of the Eighth International Conference \u201cRandom Structures and Algorithms\u201d (Poznan, 1997), Vol. 13, 1998, 189\u201320999k:68038"},{"key":"R19","doi-asserted-by":"publisher","DOI":"10.1016\/0020-0190(95)00150-B"},{"key":"R20","unstructured":"S. Roura,\n                      Divide\u2010and\u2010Conquer Algorithms and Data Structures\n                      , Ph.D. thesis, Dept. Llenguatges i Sistemes Inform\u00e0tics, Universitat Polit\u00e8cnica de Catalunya, Barcelona, Spain, 1997."},{"key":"R21","doi-asserted-by":"publisher","DOI":"10.1145\/375827.375837"},{"key":"R22","doi-asserted-by":"publisher","DOI":"10.1007\/BF00289467"},{"key":"R23","doi-asserted-by":"publisher","DOI":"10.1145\/359619.359631"},{"key":"R24","unstructured":"R. Sedgewick,\n                      Quicksort\n                      , Garland, New York, 1978."},{"key":"R25","doi-asserted-by":"publisher","DOI":"10.1145\/362875.362901"},{"key":"R26","doi-asserted-by":"publisher","DOI":"10.1145\/362736.362753"}],"container-title":["SIAM Journal on Computing"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/epubs.siam.org\/doi\/pdf\/10.1137\/S0097539700382108","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,8,21]],"date-time":"2026-08-21T18:18:21Z","timestamp":1787336301000},"score":1,"resource":{"primary":{"URL":"https:\/\/epubs.siam.org\/doi\/10.1137\/S0097539700382108"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2001,1]]},"references-count":27,"journal-issue":{"issue":"3","published-print":{"date-parts":[[2001,1]]}},"alternative-id":["10.1137\/S0097539700382108"],"URL":"https:\/\/doi.org\/10.1137\/s0097539700382108","relation":{},"ISSN":["0097-5397","1095-7111"],"issn-type":[{"value":"0097-5397","type":"print"},{"value":"1095-7111","type":"electronic"}],"subject":[],"published":{"date-parts":[[2001,1]]}}}