Abstract
An optimalO(log logn)-time CRCW-PRAM algorithm for computing all period lengths of a string is presented. Previous parallel algorithms compute the period only if it is shorter than half of the length of the string. The algorithm can be used to find all initial palindromes of a string in the same time and processor bounds. Both algorithms are the fastest possible over a general alphabet. We derive a lower bound for finding initial palindromes by modifying a known lower bound for finding the period length of a string [9]. Whenp processors are available the bounds become Θ(⌈n/p⌉+log⌈1+p/n⌉2p).
Similar content being viewed by others
References
A. Apostolico and D. Breslauer. An optimalO(log logn) time parallel algorithm for detecting all squares in a string.SIAM J. Comput., to appear.
A. Apostolico, D. Breslauer, and Z. Galil. Optimal parallel algorithms for periods, palindromes and squares.Proc. 19th Internat. Colloq. on Automata, Languages, and Programming. Lecture Notes in Computer Science, Vol. 623. Springer-Verlag, Berlin, 1992, pages 296–307.
H. W. Bergerson.Palindromes and Anagrams. Dover. New York, 1973.
R. P. Brent. Evaluation of general arithmetic expressions.J. Assoc. Comput. Mach., 21:201–206, 1974.
D. Breslauer. Efficient String Algorithmics. Ph.D. thesis, Department of Computer Science, Columbia University, New York, 1992.
D. Breslauer. Fast parallel string prefix-matching.Theoret. Comput. Sci., 137(2):269–278, 1995.
D. Breslauer. Testing string superprimitivity in parallel.Inform. Process. Lett., 49:5 235–241, 1994.
D. Breslauer and Z. Galil. An optimalO(log logn) time parallel string matching algorithm.SIAM J. Comput., 19(6): 1051–1058, 1990.
D. Breslauer and Z. Galil. A lower bound for parallel string matching.SIAM J. Comput., 21(5):856–862. 1992.
M. Crochemore and W. Rytter. Usefulness of the Karp-Miller-Rosenberg algorithm in parallel computations on strings and arrays.Theoret. Comput. Sci., 88:59–82, 1991.
F. E. Fich, R. L. Radge, and A. Wigderson. Relations between concurrent-write models of parallel computation.Proc. 3rd ACM Symp. on Principles of Distributed Computing, 1984, pages 179–189.
M. J. Fischer and M. S. Paterson. Sring matching and other produces. In R. M. Karp, editor,Complexity of Computation. American Mathematical Society, Providence, RI, 1974, pages 113–125.
G. Galil. Optimal parallel algorithms for string matching.Inform. and Control. 67:144–157, 1985.
J. E. Hopcroft and J. D. Ullman.Introduction to Automata Theory, Languages and Computation. Addison-Wesley, Reading, MA, 1979.
R. M. Karp, R. E. Miller, and A. L. Rosenberg. Rapid identification of repeated patterns in strings, trees and arrays.Proc. 4th ACM Symp. on Theory of Computing, 1972, pages 125–136.
Z. Kedem, G. M. Landau, and K. Palem. Optimal parallel suffix-prefix matching algorithm and applications.Proc. 1st ACM Symp. on Parallel Algorithms and Architectures, 1989, pages 388–398.
D. E. Knuth, J. H. Morris, and V. R. Pratt. Fast pattern matching in strings.SIAM J. Comput., 6:322–350, 1977.
M. Lothaire.Combinatorics on Words. Addison-Wesley, Reading, MA, 1983.
R. C. Lyndon and M. P. Schutzenberger. The equation am=bncp in a free group.Michigan Math. J., 9:289–298, 1962.
G. Manacher. A new linear-time “On-line” algorithm for finding the smallest initial palindrome of a string.J. Assoc. Comput. Mach., 22:346–351, 1975.
L. G. Valiant. Parallelism in comparison models.SIAM J. Comput., 4:348–355, 1975.
U. Vishkin. Optimal parallel pattern matching in strings.Inform. and Control, 67:91–113, 1985.
Author information
Authors and Affiliations
Additional information
Communicated by F. T. Leighton.
This work was partially supported by NSF Grant CCR-90-14605. D. Breslauer was partially supported by an IBM Graduate Fellowship while studying at Columbia University and by a European Research Consortium for Informatics and Mathematics postdoctoral fellowship.
Rights and permissions
About this article
Cite this article
Breslauer, D., Galil, Z. Finding all periods and initial palindromes of a string in parallel. Algorithmica 14, 355–366 (1995). https://doi.org/10.1007/BF01294132
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF01294132