, Volume 14, Issue 4, pp 355–366 | Cite as

Finding all periods and initial palindromes of a string in parallel

  • D. Breslauer
  • Z. Galil


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/n2p).

Key words

Parallel algorithms Lower bounds Comparison model Strings Periods Palindromes 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    A. Apostolico and D. Breslauer. An optimalO(log logn) time parallel algorithm for detecting all squares in a string.SIAM J. Comput., to appear.Google Scholar
  2. [2]
    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.Google Scholar
  3. [3]
    H. W. Bergerson.Palindromes and Anagrams. Dover. New York, 1973.Google Scholar
  4. [4]
    R. P. Brent. Evaluation of general arithmetic expressions.J. Assoc. Comput. Mach., 21:201–206, 1974.Google Scholar
  5. [5]
    D. Breslauer. Efficient String Algorithmics. Ph.D. thesis, Department of Computer Science, Columbia University, New York, 1992.Google Scholar
  6. [6]
    D. Breslauer. Fast parallel string prefix-matching.Theoret. Comput. Sci., 137(2):269–278, 1995.Google Scholar
  7. [7]
    D. Breslauer. Testing string superprimitivity in parallel.Inform. Process. Lett., 49:5 235–241, 1994.Google Scholar
  8. [8]
    D. Breslauer and Z. Galil. An optimalO(log logn) time parallel string matching algorithm.SIAM J. Comput., 19(6): 1051–1058, 1990.Google Scholar
  9. [9]
    D. Breslauer and Z. Galil. A lower bound for parallel string matching.SIAM J. Comput., 21(5):856–862. 1992.Google Scholar
  10. [10]
    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.Google Scholar
  11. [11]
    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.Google Scholar
  12. [12]
    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.Google Scholar
  13. [13]
    G. Galil. Optimal parallel algorithms for string matching.Inform. and Control. 67:144–157, 1985.Google Scholar
  14. [14]
    J. E. Hopcroft and J. D. Ullman.Introduction to Automata Theory, Languages and Computation. Addison-Wesley, Reading, MA, 1979.Google Scholar
  15. [15]
    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.Google Scholar
  16. [16]
    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.Google Scholar
  17. [17]
    D. E. Knuth, J. H. Morris, and V. R. Pratt. Fast pattern matching in strings.SIAM J. Comput., 6:322–350, 1977.Google Scholar
  18. [18]
    M. Lothaire.Combinatorics on Words. Addison-Wesley, Reading, MA, 1983.Google Scholar
  19. [19]
    R. C. Lyndon and M. P. Schutzenberger. The equation am=bncp in a free group.Michigan Math. J., 9:289–298, 1962.Google Scholar
  20. [20]
    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.Google Scholar
  21. [21]
    L. G. Valiant. Parallelism in comparison models.SIAM J. Comput., 4:348–355, 1975.Google Scholar
  22. [22]
    U. Vishkin. Optimal parallel pattern matching in strings.Inform. and Control, 67:91–113, 1985.Google Scholar

Copyright information

© Springer-Verlag New York Inc. 1995

Authors and Affiliations

  • D. Breslauer
    • 1
  • Z. Galil
    • 2
    • 3
  1. 1.CWIGB AmsterdamThe Netherlands
  2. 2.Computer Science DepartmentColumbia UniversityNew YorkUSA
  3. 3.Tel-Aviv UniversityRamat AvivIsrael

Personalised recommendations