Computing the Pattern Waiting Time: A Revisit of the Intuitive Approach
We revisit the waiting time of patterns in repeated independent experiments. We show that the most intuitive approach for computing the waiting time, which reduces it to computing the stopping time of a Markov chain, is optimum from the perspective of computational complexity. For the single pattern case, this approach requires us to solve a system of m linear equations, where m denotes the length of the pattern. We show that this system can be solved in O(m + n) time, where n denotes the number of possible outcomes of each single experiment. The main procedure only costs O(m) time, while a preprocessing rocedure costs O(m + n) time. For the multiple pattern case, our approach is as efficient as the one given by Li [Ann. Prob., 1980].
Our method has several advantages over other methods. First, it extends to compute the variance or even higher moment of the waiting time for the single pattern case. Second, it is more intuitive and does not entail tedious mathematics and heavy probability theory. Our main result (Theorem 2) might be of independent interest to the theory of linear equations.
Pattern Occurrence
Waiting Time
Penney’s Game
Markov Chain
39:1-39:12
Regular Paper
Kai
Jin
Kai Jin
10.4230/LIPIcs.ISAAC.2016.39
Anonymous. Penney’s game. Technical report, Wikipedia, 2016. URL: https://en.wikipedia.org/wiki/Penney%27s_game.
https://en.wikipedia.org/wiki/Penney%27s_game
J. A. D. Aston and D. E. K. Martin. Waiting time distributions of competing patterns in higher-order markovian sequences. Journal of Applied Probability, 42(4):977-988, 2005.
N. Balakrishnan and M. V. Koutras. Runs and Scans with Applications. Wiley, 2002.
S. Breen, M. S. Waterman, and N. Zhang. Renewal theory for several patterns. Journal of Applied Probability, 22(1):228-234, 1985.
O. Chrysaphinou and S. Papastavridis. The occurrence of sequence patterns in repeated dependent experiments. Theory of Probability &Its Applications, 35(1):145-152, 1991. URL: http://dx.doi.org/10.1137/1135015.
http://dx.doi.org/10.1137/1135015
J. A. Csirik. Optimal strategy for the first player in the penney ante game. Combinatorics, Probability and Computing, 1:311-321, 1992. URL: http://dx.doi.org/10.1017/S0963548300000365.
http://dx.doi.org/10.1017/S0963548300000365
W. Feller. An Introduction to Probability Theory and its Applications, volume 1. Wiley, 3 edition, 1968.
J. C. Fu and W. Y. W. Lou. Distribution Theory of Runs and Patterns and Its Applications. World Scientific Publishing, 2003.
I. Fudos, E. Pitoura, and W. Szpankowski. On pattern occurrences in a random text. Information Processing Letters, 57(6):307-312, 1996.
M. Gardner. On the paradoxical situations that arise from nontransitive relations. Scientific American, 231(4), 1974.
R. L. Graham, D. E. Knuth, and O. Patashnik. Concrete Mathematics: A Foundation for Computer Science. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2nd edition, 1994.
L. J. Guibas and A. M. Odlyzko. String overlaps, pattern matching, and nontransitive games. Journal of Combinatorial Theory, Series A, 30(2):183-208, 1981. URL: http://dx.doi.org/10.1016/0097-3165(81)90005-4.
http://dx.doi.org/10.1016/0097-3165(81)90005-4
D. E. Knuth, Jr. J. H. Morris, and V. R. Pratt. Fast pattern matching in strings. SIAM Journal on Computing, 6(2):323-350, 1977. URL: http://dx.doi.org/10.1137/0206024.
http://dx.doi.org/10.1137/0206024
S. R. Li. A martingale approach to the study of occurrence of sequence patterns in repeated experiments. The Annals of Probability, 8(6):1171-1176, 1980.
M. E. Lladser, M. D. Betterton, and R. Knight. Multiple pattern matching: a markov chain approach. Journal of Mathematical Biology, 56(1):51-92, 2007. URL: http://dx.doi.org/10.1007/s00285-007-0109-3.
http://dx.doi.org/10.1007/s00285-007-0109-3
M. Lothaire. Applied Combinatorics on Words. Cambridge University Press, 2005.
W. Penney. Problem 95: Penney-ante. Journal of Recreational Mathematics, page 241, 1969.
V. Pozdnyakov. On occurrence of patterns in markov chains: Method of gambling teams. Statistics &Probability Letters, 78(16):2762-2767, 2008. URL: http://dx.doi.org/10.1016/j.spl.2008.03.023.
http://dx.doi.org/10.1016/j.spl.2008.03.023
V. Pozdnyakov and M. Kulldorff. Waiting times for patterns and a method of gambling teams. The American Mathematical Monthly, 113(2):134-143, 2006.
M. Régnier. A unified approach to word occurrence probabilities. Discrete Applied Mathematics, 104:259-280, 2000.
M. Régnier and W. Szpankowski. On pattern frequency occurrences in a markovian sequence. Algorithmica, 22(4):631-649, 1998. URL: http://dx.doi.org/10.1007/PL00009244.
http://dx.doi.org/10.1007/PL00009244
G. Reinert, S. Schbath, and M. S. Waterman. Probabilistic and statistical properties of words: An overview. Journal of Computational Biology, 7(2):1-46, 2000.
A. D. Solov'ev. A combinatorial identity and its application to the problem concerning the first occurrence of a rare event. Theory of Probability &Its Applications, 11(2):276-282, 1966. URL: http://dx.doi.org/10.1137/1111022.
http://dx.doi.org/10.1137/1111022
Creative Commons Attribution 3.0 Unported license
https://creativecommons.org/licenses/by/3.0/legalcode