Abstract
We study the complexity of a classical combinatorial problem of computing the period of a string. We investigate both the average- and the worst-case complexity of the problem.
We deliver almost tight bounds for the average-case. We show that every algorithm computing the period must examine \( \Omega (\sqrt m ) \) symbols of an input string of length m. On the other hand we present an algorithm that computes the period by examining on average \( {\rm O}\left( {\sqrt {m \cdot \log _{|\sum |} m} } \right) \) symbols, where \( \left| \sum \right| \geqslant 2 \) stands for the input alphabet.
We also present a deterministic algorithm that computes the period of a string using m + O(m 3/4) comparisons. This is the first algorithm that have the worst-case complexity m + o(m).
Work partly done while the author was with the Heinz Nixdorf Institute and Department of Mathematics & Computer Science at the University of Paderborn, D-33095 Paderborn, Germany.
Supported in part by Nuffield Foundation Award for newly appointed lecturers NUF-NAL.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
A. V. Aho. Algorithms for finding patterns in strings. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, Vol. A: Algorithms and Complexity, chapter 5, pages 257–300. Elsevier Science, Amsterdam, 1990.
A. Amir and G. Benson. Two-dimensional periodicity in rectangular arrays. SIAM Journal on Computing, 27(1):90–106, February 1998.
A. Amir, G. Benson, and M. Farach. Alphabet independent two dimensional matching. In Proceedings of the 24th Annual ACM Symposium on Theory of Computing, pages 59–68, Victoria, British Columbia, Canada, May 4–6, 1992. ACM Press, New York, NY.
A. Amir, G. Benson, and M. Farach. An alphabet independent approach to two-dimensional pattern matching. SIAM Journal on Computing, 23(2):313–323, April 1994.
A. Apostolico and M. Crochemore. Optimal canonization of all substrings of a string. Information and Computation, 95(1):76–95, November 1991
A. Apostolico and Z. Galil, editors. Pattern Matching Algorithms. Oxford University Press, New York, NY, 1997.
A. Apostolico and R. Giancarlo. The Boyer-Moore-Galil string searching strategies revisited. SIAM Journal on Computing, 15(1):98–105, February 1986.
R. S. Boyer and J.S. Moore. A fast string searching algorithm. Communications of the ACM, 20:762–772, 1977.
D. Breslauer, L. Colussi, and L. Toniolo. Tight comparison bounds for the string prefix-matching problem. Information Processing Letters, 47(1):51–57, August 1993.
D. Breslauer, L. Colussi, and L. Toniolo. On the comparison complexity of the string prefix-matching problem. Journal of Algorithms, 29(1):18–67, October 1998.
D. Breslauer and Z. Galil. An optimal O(log log n) time parallel string matching algorithm. SIAM Journal on Computing, 19(6):1051–1058, December 1990.
D. Breslauer and Z. Galil. A lower bound for parallel string matching. SIAM Journal on Computing, 21(5):856–862, October 1992. A preliminary version appears in Proceedings of the 23rd Annual ACM Symposium on Theory of Computing, pages 439–443, New Orleans, Louisiana, May 6–8, 1991. ACM Press, New York, NY.
D. Breslauer and Z. Galil. Efficient comparison based string matching. Journal of Complexity, 9(3):339–365, September 1993.
R. Cole. Tight bounds on the complexity of the Boyer-Moore string matching algorithm. SIAM Journal on Computing, 23(5):1075–1091, October 1994.
R. Cole, M. Crochemore, Z. Galil, L. Gçasieniec, R. Hariharan, S. Muthukrishnan, K. Park, and W. Rytter. Optimally fast parallel algorithms for preprocessing and pattern matching in one and two dimensions. In Proceedings of the 34th IEEE Symposium on Foundations of Computer Science, pages 248–258, Palo Alto, CA, November 3–5, 1993. IEEE Computer Society Press, Los Alamitos, CA.
R. Cole and R. Hariharan. Tighter upper bounds on the exact complexity of string matching. SIAM Journal on Computing, 26(3):803–856, June 1997.
R. Cole, R. Hariharan, M. Paterson, and U. Zwick. Tighter lower bounds on the exact complexity of string matching. SIAM Journal on Computing, 24(l):30–45, February 1995.
L. Colussi. Correctness and efficiency of pattern matching algorithms. Information and Computation, 95(2):225–251, December 1991.
L. Colussi, Z. Galil, and R. Giancarlo. On the exact complexity of string matching. In Proceedings of the 22nd Annual ACM Symposium on Theory of Computing, pages 135–144, Baltimore, MD, May 14–16, 1990. ACM Press, New York, NY.
M. Crochemore. Off-line serial exact string searching. In A. Apostolico and Z. Galil, editors, Pattern Matching Algorithms, chapter I, pages 1–53. Oxford University Press, New York, NY, 1997.
M. Crochemore. String-matching on ordered alphabets. Theoretical Computer Science, 92(1):33–47, January 1992
M. Crochemore, A. Czumaj, L. Gçasieniec, S. Jarominek, T. Lecroq, W. Plandowski, and W. Rytter. Speeding up two string-matching algorithms. Algorithmica, 12(4/5):247–267, October 1994.
M. Crochemore, Z. Galil, L. Gçasieniec, K. Park, and W. Rytter. Constant-time randomized parallel string matching. SIAM Journal on Computing, 26(4):950–960, August 1997.
M. Crochemore, L. Gçasieniec, W. Plandowski, and W. Rytter. Two-dimensional pattern matching in linear time and small space. In Proceedings of the 12th Annual Symposium on Theoretical Aspects of Computer Science, volume 900 of Lecture Notes in Computer Science, pages 181–192, Munich, Germany, March 2–4, 1995. Springer-Verlag, Berlin.
M. Crochemore and D. Perrin. Two-way string-matching. Journal of the ACM, 38(3):651–675, July 1991.
M. Crochemore and W. Rytter. Text Algorithms. Oxford University Press, New York, NY, 1994.
A. Czumaj, Z. Galil, L. Gçasieniec, K. Park, and W. Plandowski. Work-time-optimal parallel algorithms for string problems. In Proceedings of the 27th Annual ACM Symposium on Theory of Computing, pages 713–722, Las Vegas, NV, May 29–June 1, 1995. ACM Press, New York, NY.
Z. Galil. Real-time algorithms for string-matching and palindrome recognition. In Proceedings of the 8th Annual ACM Symposium on Theory of Computing, pages 161–173, Hershey, PA, May 3–5, 1976. ACM Press, New York, NY.
Z. Galil. On improving the worst case running time of the Boyer-Moore string matching algorithm. Communications of the ACM, 22(9):505–508, September 1979.
Z. Galil. Optimal parallel algorithms for string matching. Information and Computation, 67(1–3): 144–157, 1985.
Z. Galil and R. Giancarlo. On the exact complexity of string matching: Lower bounds. SIAM Journalon Computing, 20(6): 1008–1020, December 1991.
Z. Galil and K. Park. Alphabet-independent two-dimensional witness computation. SIAM Journalon Computing, 25(5):907–935, October 1996.
Z. Galil and J. Seiferas. Time-space-optimal string matching. Journal of Computer and System Sciences, 26(3):280–294, June 1983.
L. Gçasieniec, W. Plandowski, and W. Rytter. Constant-space string matching with smaller number of comparisons: Sequential sampling. In Z. Galil and E. Ukkonen, editors, Proceedings of the 6th Symposium on Combinatorial Pattern Matching, volume 937 of Lecture Notes in Computer Science, pages 78–89, Espoo, Finland, July 5–7, 1995. Springer-Verlag, Berlin.
L. Gçasieniec, W. Plandowski, and W. Rytter. The zooming method: a recursive approach to time-space efficient string-matching. Theoretical Computer Science, 147(1–2):19–30, August 1995
D. Gusfield. Algorithms on Strings, Trees and Sequences. Cambridge University Press, New York, NY, 1997.
D. E. Knuth, J. H. Morris, and V. R. Pratt. Fast pattern matching in strings. SIAM Journal on Computing, 6(2):323–350, June 1977.
M. Lothaire. Combinatorics on Words. Addison-Wesley, Reading, MA, 1983.
M. Lothaire. Algebraic Combinatorics on Words. Addison-Wesley, Reading, MA, 1999.
R.C Lyndon and M.P. Schutzenberger. The equation a m = bn cp in a free group, Michigan Math. J., 9: 289–298, 1962.
R. L. Rivest. On the worst case behavior of string searching algorithms. SIAM Journal on Computing, 6(4):669–674, December 1977.
W. Rytter. A correct preprocessing algorithm for Boyer-Moore string-searching. SIAM Journal on Computing, 9(3):509–512, August 1980.
U. Vishkin. Optimal parallel pattern matching in strings. Information and Computation, 67(1-3):91–113, October 1985.
U. Vishkin. Deterministic sampling-a new technique for fast pattern matching. SIAM Journalon Computing, 20(l):22–40, February 1991.
A. C. Yao. The complexity of pattern matching for a random string. SIAM Journal on Computing, 8(3):368–387, August 1979.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Czumaj, A., Gçasieniec, L. (2000). On the Complexity of Determining the Period of a String. In: Giancarlo, R., Sankoff, D. (eds) Combinatorial Pattern Matching. CPM 2000. Lecture Notes in Computer Science, vol 1848. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45123-4_34
Download citation
DOI: https://doi.org/10.1007/3-540-45123-4_34
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-67633-1
Online ISBN: 978-3-540-45123-5
eBook Packages: Springer Book Archive