Skip to main content
Log in

A Note on Average-Case Sorting

  • Published:
Order Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Cover, T.M., Thomas, J.A.: Elements of Information Theory. ISBN 978-0-471-24195-9, pp. 1–748. Wiley (2006)

  2. Fredman, M.L.: How good is the information theory bound in sorting Theor. Comput. Sci. 1, 355–361 (1976)

    Article  MathSciNet  MATH  Google Scholar 

  3. Gilbert, E.N., Moore, E.F.: Variable-length binary encodings. Bell Syst. Tech. J 38(4), 933–968 (1959)

    Article  MathSciNet  Google Scholar 

  4. Kahn, J., Kim, J.H.: Entropy and sorting. J. Comput. Syst. Sci. 51(3), 390–399 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  5. Kahn, J., Saks, M.: Balancing poset extensions. Order 1, 113–126 (1984)

    Article  MathSciNet  MATH  Google Scholar 

  6. Knuth, D.E.: The Art of Computer Programming, Vol. 3. Addison-Wesley, Reading, Mass. (1973)

  7. Leighton, T., Moitra, A.: On Entropy and Extensions of Posets. Manuscript (2011)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Shay Moran.

Additional information

Horev fellow – supported by the Taub foundation. Research also supported by ISF and BSF.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Moran, S., Yehudayoff, A. A Note on Average-Case Sorting. Order 33, 23–28 (2016). https://doi.org/10.1007/s11083-015-9347-y

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11083-015-9347-y

Keywords

Navigation