Skip to main content
Log in

Sorting Using Complete Subintervals and the Maximum Number of Runs in a Randomly Evolving Sequence

  • Published:
Annals of Combinatorics Aims and scope Submit manuscript

Abstract

We study the space requirements of a sorting algorithm where only items that at the end will be adjacent are kept together. This is equivalent to the following combinatorial problem: Consider a string of fixed length n that starts as a string of 0’s, and then evolves by changing each 0 to 1, with the n changes done in random order. What is the maximal number of runs of 1’s? We give asymptotic results for the distribution and mean. It turns out that, as in many problems involving a maximum, the maximum is asymptotically normal, with fluctuations of order n 1/2, and to the first order well approximated by the number of runs at the instance when the expectation is maximized, in this case when half the elements have changed to 1; there is also a second order term of order n 1/3. We also treat some variations, including priority queues and sock-sorting. The proofs use methods originally developed for random graphs.

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. af Hällström G.: Ein lineares Inselproblem der kombinatorischen Wahr-schein-lich-keitsrech- nung, Ann. Acad. Sci. Fennicae. Ser. A. I. Math.-Phys. 1952(123), 9 (1952)

    MathSciNet  Google Scholar 

  2. Barbour A.D.: A note on the maximum size of a closed epidemic. J. R. Stat. Soc. Ser. B 37(3), 459–460 (1975)

    MATH  MathSciNet  Google Scholar 

  3. Barbour A.D.: Brownian motion and a sharply curved boundary. Adv. in Appl. Probab. 13(4), 736–750 (1981)

    Article  MATH  MathSciNet  Google Scholar 

  4. Billingsley P.: Convergence of Probability Measures. John Wiley & Sons, New York- London-Sydney (1968)

    MATH  Google Scholar 

  5. Daniels H.E.: The maximum size of a closed epidemic. Adv. in Appl. Probab. 6, 607–621 (1974)

    Article  MATH  MathSciNet  Google Scholar 

  6. Daniels H.E.: The maximum of a Gaussian process whose mean path has a maximum, with an application to the strength of bundles of fibres. Adv. in Appl. Probab. 21(2), 315–333 (1989)

    Article  MATH  MathSciNet  Google Scholar 

  7. Daniels H.E., Skyrme T.H.R.: The maximum of a random walk whose mean path has a maximum. Adv. in Appl. Probab. 17(1), 85–99 (1985)

    Article  MATH  MathSciNet  Google Scholar 

  8. Flajolet P., Françon J., Vuillemin J.: Sequence of operations analysis for dynamic data structures. J. Algorithms 1(2), 111–141 (1980)

    Article  MATH  MathSciNet  Google Scholar 

  9. Flajolet P., Puech C., Vuillemin J.: The analysis of simple list structures. Inform. Sci. 38(2), 121–146 (1986)

    Article  MATH  MathSciNet  Google Scholar 

  10. Groeneboom P.: Brownian motion with a parabolic drift and Airy functions. Probab. Theory Related Fields 81(1), 79–109 (1989)

    Article  MathSciNet  Google Scholar 

  11. Gut A.: Probability: A Graduate Course. Springer, New York (2005)

    MATH  Google Scholar 

  12. Jacod J., Shiryaev A.N.: Limit Theorems for Stochastic Processes. Springer-Verlag, Berlin (1987)

    MATH  Google Scholar 

  13. Janson S.: A functional limit theorem for random graphs with applications to subgraph count statistics. Random Structures Algorithms 1(1), 15–37 (1990)

    Article  MATH  MathSciNet  Google Scholar 

  14. Janson S.: Orthogonal decompositions and dunctional limit theorems for random graph statistics. Mem. Amer. Math. Soc. 111(534), vi+78 (1994)

    MathSciNet  Google Scholar 

  15. Janson S.: Functional limit theorems for multitype branching processes and generalized P´olya urns. Stochastic Process. Appl. 110(2), 177–245 (2004)

    Article  MathSciNet  Google Scholar 

  16. Kallenberg O.: Foundations of Modern Probability, 2nd Ed. New York, Springer-Verlag (2002)

    MATH  Google Scholar 

  17. Kenyon C.M., Vitter J.S.: Maximum queue size and hashing with lazy deletion. Algorithmica 6(4), 597–619 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  18. W.V. Li and G. Pritchard, A central limit theorem for the sock-sorting problem, In: High Dimensional Probability, Progr. Probab., Vol. 43, Birkhäuser, Basel, (1998) pp. 245–248.

  19. Louchard G.: Random walks, Gaussian processes and list structures, Theoret. Comput. Sci. 53(1), 99–124 (1987)

    MATH  MathSciNet  Google Scholar 

  20. Louchard G.: Large finite population queueing systems part I: the infinite server model. Comm. Statist. Stochastic Models 4(3), 473–505 (1988)

    Article  MATH  MathSciNet  Google Scholar 

  21. Louchard G., Kenyon C., Schott R.: Data structures’ maxima. SIAM J. Comput. 26(4), 1006–1042 (1997)

    Article  MATH  MathSciNet  Google Scholar 

  22. Mood A.M.: The distribution theory of runs. Ann. Math. Statistics 11, 367–392 (1940)

    Article  MATH  MathSciNet  Google Scholar 

  23. D. Steinsaltz, Random time changes for sock-sorting and other stochastic process limit theorems, Electron. J. Probab. 4 (1999) paper 14.

    Google Scholar 

  24. Stevens W.L.: Distribution of groups in a sequence of alternatives. Annals of Eugenics 9, 10–17 (1939)

    MathSciNet  Google Scholar 

  25. Van Wyk C.J., Vitter J.S.: The complexity of hashing with lazy deletion. Algorithmica 1, 17–29 (1986)

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Svante Janson.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Janson, S. Sorting Using Complete Subintervals and the Maximum Number of Runs in a Randomly Evolving Sequence. Ann. Comb. 12, 417–447 (2009). https://doi.org/10.1007/s00026-009-0007-z

Download citation

  • Received:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00026-009-0007-z

Keywords

AMS Subject Classification

Navigation