Order

, Volume 33, Issue 1, pp 23–28 | Cite as

A Note on Average-Case Sorting

Article

Abstract

This note studies the average-case comparison-complexity of sorting n elements when there is a known distribution on inputs and the goal is to minimize the expected number of comparisons. We generalize Fredman’s algorithm which is a variant of insertion sort and provide a basically tight upper bound: If μ is a distribution on permutations on n elements, then one may sort inputs from μ with expected number of comparisons that is at most H(μ) + 2n, where H is the entropy function. The algorithm uses less comparisons for more probable inputs: For every permutation π, the algorithm sorts π by using at most \(\log _{2}(\frac {1}{\Pr _{\mu }(\pi )})+2n\) comparisons. A lower bound on the expected number of comparisons of H(μ) always holds, and a linear dependence on n is also required.

Keywords

Comparison based sorting Average-case complexity Shannon’s entropy 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Cover, T.M., Thomas, J.A.: Elements of Information Theory. ISBN 978-0-471-24195-9, pp. 1–748. Wiley (2006)Google Scholar
  2. 2.
    Fredman, M.L.: How good is the information theory bound in sorting Theor. Comput. Sci. 1, 355–361 (1976)CrossRefMathSciNetMATHGoogle Scholar
  3. 3.
    Gilbert, E.N., Moore, E.F.: Variable-length binary encodings. Bell Syst. Tech. J 38(4), 933–968 (1959)CrossRefMathSciNetGoogle Scholar
  4. 4.
    Kahn, J., Kim, J.H.: Entropy and sorting. J. Comput. Syst. Sci. 51(3), 390–399 (1995)CrossRefMathSciNetMATHGoogle Scholar
  5. 5.
    Kahn, J., Saks, M.: Balancing poset extensions. Order 1, 113–126 (1984)CrossRefMathSciNetMATHGoogle Scholar
  6. 6.
    Knuth, D.E.: The Art of Computer Programming, Vol. 3. Addison-Wesley, Reading, Mass. (1973)Google Scholar
  7. 7.
    Leighton, T., Moitra, A.: On Entropy and Extensions of Posets. Manuscript (2011)Google Scholar

Copyright information

© Springer Science+Business Media Dordrecht 2015

Authors and Affiliations

  1. 1.Department of Computer ScienceTechnion-IITHaifaIsrael
  2. 2.Max Planck Institute for InformaticsSaarbrückenGermany
  3. 3.Department of MathematicsTechnion-IITHaifaIsrael

Personalised recommendations