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.
Similar content being viewed by others
References
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)
Barbour A.D.: A note on the maximum size of a closed epidemic. J. R. Stat. Soc. Ser. B 37(3), 459–460 (1975)
Barbour A.D.: Brownian motion and a sharply curved boundary. Adv. in Appl. Probab. 13(4), 736–750 (1981)
Billingsley P.: Convergence of Probability Measures. John Wiley & Sons, New York- London-Sydney (1968)
Daniels H.E.: The maximum size of a closed epidemic. Adv. in Appl. Probab. 6, 607–621 (1974)
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)
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)
Flajolet P., Françon J., Vuillemin J.: Sequence of operations analysis for dynamic data structures. J. Algorithms 1(2), 111–141 (1980)
Flajolet P., Puech C., Vuillemin J.: The analysis of simple list structures. Inform. Sci. 38(2), 121–146 (1986)
Groeneboom P.: Brownian motion with a parabolic drift and Airy functions. Probab. Theory Related Fields 81(1), 79–109 (1989)
Gut A.: Probability: A Graduate Course. Springer, New York (2005)
Jacod J., Shiryaev A.N.: Limit Theorems for Stochastic Processes. Springer-Verlag, Berlin (1987)
Janson S.: A functional limit theorem for random graphs with applications to subgraph count statistics. Random Structures Algorithms 1(1), 15–37 (1990)
Janson S.: Orthogonal decompositions and dunctional limit theorems for random graph statistics. Mem. Amer. Math. Soc. 111(534), vi+78 (1994)
Janson S.: Functional limit theorems for multitype branching processes and generalized P´olya urns. Stochastic Process. Appl. 110(2), 177–245 (2004)
Kallenberg O.: Foundations of Modern Probability, 2nd Ed. New York, Springer-Verlag (2002)
Kenyon C.M., Vitter J.S.: Maximum queue size and hashing with lazy deletion. Algorithmica 6(4), 597–619 (1991)
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.
Louchard G.: Random walks, Gaussian processes and list structures, Theoret. Comput. Sci. 53(1), 99–124 (1987)
Louchard G.: Large finite population queueing systems part I: the infinite server model. Comm. Statist. Stochastic Models 4(3), 473–505 (1988)
Louchard G., Kenyon C., Schott R.: Data structures’ maxima. SIAM J. Comput. 26(4), 1006–1042 (1997)
Mood A.M.: The distribution theory of runs. Ann. Math. Statistics 11, 367–392 (1940)
D. Steinsaltz, Random time changes for sock-sorting and other stochastic process limit theorems, Electron. J. Probab. 4 (1999) paper 14.
Stevens W.L.: Distribution of groups in a sequence of alternatives. Annals of Eugenics 9, 10–17 (1939)
Van Wyk C.J., Vitter J.S.: The complexity of hashing with lazy deletion. Algorithmica 1, 17–29 (1986)
Author information
Authors and Affiliations
Corresponding author
Rights 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
Received:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00026-009-0007-z