Optimal sampling strategies in quicksort

被引:0
|
作者
Martínez, C [1 ]
Roura, S [1 ]
机构
[1] Univ Politecn Catalunya, Dept Llenguatges & Sistemes Informat, E-08034 Barcelona, Catalonia, Spain
来源
关键词
D O I
暂无
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
It is well known that the performance of quicksort can be substantially improved by selecting the median of a sample of three elements as the pivot of each partitioning stage. This variant is easily generalized to samples of size s = 2k + 1. For large samples the partitions are better as the median of the sample makes a more accurate estimate of the median of the array to be sorted, but the amount of additional comparisons and exchanges to find the median of the sample also increases. We show that the optimal sample size to minimize the average total cost of quicksort (which includes both comparisons and exchanges) is s = a . root n + o(root n). We also give a closed expression for the constant factor a, which depends on the median-finding algorithm and the costs of elementary comparisons and exchanges. The result above holds in most situations, unless the cost of an exchange exceeds by far the cost of a comparison. In that particular case, it is better to select not the median of the samples, but the (p + 1)(th) element. The value of p can be precisely determined as a function of the ratio between the cost of an exchange and the cost of a comparison.
引用
收藏
页码:327 / 338
页数:12
相关论文
共 50 条
  • [31] OPTIMAL SAMPLING STRATEGIES FOR MAPPING SOIL TYPES .2. RISK FUNCTIONS AND SAMPLING INTERVALS
    BURGESS, TM
    WEBSTER, R
    JOURNAL OF SOIL SCIENCE, 1984, 35 (04): : 655 - 665
  • [32] OPTIMAL SAMPLING STRATEGIES FOR STATISTICAL-MODELS WITH DISCRETE DEPENDENT VARIABLES
    DAGANZO, CF
    TRANSPORTATION SCIENCE, 1980, 14 (04) : 324 - 345
  • [33] DEVELOPMENT OF A POPULATION PHARMACOKINETIC MODEL AND OPTIMAL SAMPLING STRATEGIES FOR INTRAVENOUS CIPROFLOXACIN
    FORREST, A
    BALLOW, CH
    NIX, DE
    BIRMINGHAM, MC
    SCHENTAG, JJ
    ANTIMICROBIAL AGENTS AND CHEMOTHERAPY, 1993, 37 (05) : 1065 - 1072
  • [34] Optimal sampling strategies for multiscale models with application to network traffic estimation
    Ribeiro, VJ
    Riedi, RH
    Baraniuk, RG
    PROCEEDINGS OF THE 2003 IEEE WORKSHOP ON STATISTICAL SIGNAL PROCESSING, 2003, : 138 - 141
  • [35] Optimal sampling strategies for the measurement of spin-spin relaxation times
    Jones, JA
    Hodgkinson, P
    Barker, AL
    Hore, PJ
    JOURNAL OF MAGNETIC RESONANCE SERIES B, 1996, 113 (01): : 25 - 34
  • [36] Optimal sampling strategies for raster-based geographical information systems
    Atkinson, PM
    GLOBAL ECOLOGY AND BIOGEOGRAPHY, 1996, 5 (4-5): : 271 - 280
  • [37] Optimal strategies for sampling functional traits in species-rich forests
    Paine, C. E. Timothy
    Baraloto, Christopher
    Diaz, Sandra
    FUNCTIONAL ECOLOGY, 2015, 29 (10) : 1325 - 1331
  • [38] Optimal Thompson Sampling strategies for support-aware CVaR bandits
    Baudry, Dorian
    Gautron, Romain
    Kaufmann, Emilie
    Maillard, Odalric-Ambrym
    INTERNATIONAL CONFERENCE ON MACHINE LEARNING, VOL 139, 2021, 139
  • [39] Optimal bandpass sampling strategies for enhancing the performance of a phase noise meter
    Angrisani, Leopoldo
    Lo Moriello, Rosario Schiano
    D'Arco, Mauro
    Greenhall, Charles
    MEASUREMENT SCIENCE AND TECHNOLOGY, 2008, 19 (10)
  • [40] Limited and optimal sampling strategies for etoposide and etoposide catechol in children with leukemia
    Panetta, JC
    Wilkinson, M
    Pui, CH
    Relling, MV
    JOURNAL OF PHARMACOKINETICS AND PHARMACODYNAMICS, 2002, 29 (02) : 171 - 188