Abstract
Most previous studies of the sorting algorithm $\mathtt{QuickSort}$ have used the number of key comparisons as a measure of the cost of executing the algorithm. Here we suppose that the $n$ independent and identically distributed (iid) keys are each represented as a sequence of symbols from a probabilistic source and that $\mathtt{QuickSort}$ operates on individual symbols, and we measure the execution cost as the number of symbol comparisons. Assuming only a mild "tameness'' condition on the source, we show that there is a limiting distribution for the number of symbol comparisons after normalization: first centering by the mean and then dividing by $n$. Additionally, under a condition that grows more restrictive as $p$ increases, we have convergence of moments of orders $p$ and smaller. In particular, we have convergence in distribution and convergence of moments of every order whenever the source is memoryless, i.e., whenever each key is generated as an infinite string of iid symbols. This is somewhat surprising: Even for the classical model that each key is an iid string of unbiased ("fair'') bits, the mean exhibits periodic fluctuations of order $n$.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
More From: Discrete Mathematics & Theoretical Computer Science
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.