Skip to search boxSkip to navigationSkip to main content

How Good Is Multi-Pivot Quicksort?

  • ,
  • Ilmenau University of Technology
    ,
  • 3DInteractive
Research Output:
Journal Article or Conference Article in Journal
Journal article
Peer-review

Open access

Abstract

Multi-Pivot Quicksort refers to variants of classical quicksort where in the partitioning step k pivots are used to split the input into k + 1 segments. For many years, multi-pivot quicksort was regarded as impractical, but in 2009 a two-pivot approach by Yaroslavskiy, Bentley, and Bloch was chosen as the standard sorting algorithm in Sun’s Java 7. In 2014 at ALENEX, Kushagra et al. introduced an even faster algorithm that uses three pivots. This article studies what possible advantages multi-pivot quicksort might offer in general. The contributions are as follows: Natural comparison-optimal algorithms for multi-pivot quicksort are devised and analyzed. The analysis shows that the benefits of using multiple pivots with respect to the average comparison count are marginal and these strategies are inferior to simpler strategies such as the well-known median-of-k approach. A substantial part of the partitioning cost is caused by rearranging elements. A rigorous analysis of an algorithm for rearranging elements in the partitioning step is carried out, observing mainly how often array cells are accessed during partitioning. The algorithm behaves best if three to five pivots are used. Experiments show that this translates into good cache behavior and is closest to predicting observed running times of multi-pivot quicksort algorithms. Finally, it is studied how choosing pivots from a sample affects sorting cost. The study is theoretical in the sense that although the findings motivate design recommendations for multipivot quicksort algorithms that lead to running-time improvements over known algorithms in an experimental setting, these improvements are small.

Publication Information

Output type

Research Output:
Journal Article or Conference Article in Journal
Journal article
Peer-review

Original language

English

Article number

8

Journal (Volume, Issue Number)

ACM Transactions on Algorithms (Volume 13, Issue 1)

Publication milestones

  • Published - 01/11/2016

Publication status

Published - 01/11/2016

ISSN

1549-6325

Publication IDs

  • Scopus: 84992176837

Publication metrics

PlumX, opens in new tab

Captures
23
Citation count
14

Access to documents