Quicksort Is Optimal For Many Equal Keys

نویسنده

  • Sebastian Wild
چکیده

I prove that the average number of comparisons for median-of-k Quicksort (with fat-pivot a.k.a. three-way partitioning) is asymptotically only a constant αk times worse than the lower bound for sorting random multisets with Ω(nε) duplicates of each value (for any ε > 0). The constant is αk = ln(2)/ ( Hk+1 −H(k+1)/2 ) , which converges to 1 as k →∞, so Quicksort is asymptotically optimal for inputs with many duplicates. This resolves a conjecture by Sedgewick and Bentley [37, 38] and constitutes the first progress on the analysis of Quicksort with equal elements since Sedgewick’s 1977 article.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Partitioning schemes for quicksort and quickselect

We introduce several modifications of the partitioning schemes used in Hoare’s quicksort and quickselect algorithms, including ternary schemes which identify keys less or greater than the pivot. We give estimates for the numbers of swaps made by each scheme. Our computational experiments indicate that ternary schemes allow quickselect to identify all keys equal to the selected key at little add...

متن کامل

A Cost Optimal Parallel Quicksort on CREW PRAM

In this paper we introduce a cost optimal parallel quicksort algorithm. It sorts an array of n elements in O(log n) time using O( n n log ) processors on a CREW PRAM. That is, the total cost is O(n log n), the same as an average sequential quicksort algorithm. The key feature of the proposed algorithm is that it partitions the array concurrently. This removes the performance bottleneck proposed...

متن کامل

0055 Large Deviations for Quicksort ∗

Let Qn be the random number of comparisons made by quicksort in sorting n distinct keys, when we assume that all n! possible orderings are equally likely. Known results concerning moments for Qn do not show how rare it is for Qn to make large deviations from its mean. Here we give a good approximation to the probability of such a large deviation, and find that this probability is quite small. A...

متن کامل

A note on multipivot Quicksort

We analyse a generalisation of the Quicksort algorithm, where k uniformly at random chosen pivots are used for partitioning an array of n distinct keys. Specifically, the expected cost of this scheme is obtained, under the assumption of linearity of the cost needed for the partition process. The integration constants of the expected cost are computed using Vandermonde matrices.

متن کامل

Quicksort Algorithm Again Revisited

We consider the standard Quicksort algorithm that sorts n distinct keys with all possible n! orderings of keys being equally likely. Equivalently, we analyze the total path length n in a randomly built binary search tree. Obtaining the limiting distribution of n is still an outstanding open problem. In this paper, we establish an integral equation for the probability density of the number of co...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2018