Optimal parallel detection of squares in strings
- 72 Downloads
A stringw isprimitive if it is not a power of another string (i.e., writingw =v k impliesk = 1. Conversely,w is asquare ifw =vv, withv a primitive string. A stringx issquare-free if it has no nonempty substring of the formww. It is shown that the square-freedom of a string ofn symbols over an arbitrary alphabet can be tested by a CRCW PRAM withn processors inO(logn) time and linear auxiliary space. If the cardinality of the input alphabet is bounded by a constant independent of the input size, then the number of processors can be reduced ton/logn without affecting the time complexity of this strategy. The fastest sequential algorithms solve this problemO(n logn) orO(n) time, depending on whether the cardinality of the input alphabet is unbounded or bounded, and either performance is known to be optimal within its class. More elaborate constructions lead to a CRCW PRAM algorithm for detecting, within the samen-processors bounds, all positioned squares inx in timeO(logn) and using linear auxiliary space. The fastest sequential algorithms solve this problem inO(n logn) time, and such a performance is known to be optimal.
Key wordsParallel computation Combinatorial algorithms on words String matching Avoidable regularities Squares and repetitions in a string
Unable to display preview. Download preview PDF.
- A. Apostolico, M. J. Atallah, L. L. Larmore, and H. S. McFaddin, Efficient Parallel Algorithms for String Editing and Related Problems,SIAM J. Comput. 19(5) (1990), 968–988. Also,Proceedings of the 26th Allerton Conference on Communications, Control and Computing, Monticello, Ill., Sept. 1988, pp. 253–263.MATHCrossRefMathSciNetGoogle Scholar
- O. Berkman, D. Breslauer, Z, Galil, B. Schieber, and U. Vishkin, Hightly Parallelizable Problems,Proceedings of the 21st ACM Symposium on Theory of Computing, Seattle, Wash., May 1989, pp. 309–319.Google Scholar
- F. E. Fich, R. L. Ragde, and A. Wigderson, Relations between Concurrent-Write Models of Parallel Computation,Proceedings of the 3rd A CM Symposium on Principles of Distributed Computing, Vancouver, B.C., Aug. 27–29, 1984, pp. 179–184.Google Scholar
- M. Lothaire,Combinatorics on Words, Addison-Wesley, Reading, Mass., 1982.Google Scholar
- M. G. Main and R. J. Lorentz, Linear-Time Recognition of Square-Free Strings, inCombinatorial Algorithms on Words (A. Apostolico and Z. Galil, eds.), Nato ASI Series F, Vol. 12, Springer-Verlag, Berlin, 1985, pp. 271–278.Google Scholar
- M. Rabin, Discovering Repetitions in Strings, inCombinatorial Algorithms on Words (A. Apostolico and Z. Galil, eds), Nato ASI Series F, Vol. 12, Springer-Verlag, Berlin, 1985, pp. 279–288.Google Scholar
- A. Thue, Über unendliche Zeichenreihen,Norske Vid. Selsk. I Mat. Natur. Kl. Skr., Christiania no. 7 (1906), 1–22.Google Scholar
- A. Thue, “Über die gegenseitige Lage gleicher Teile gewisser Zeichenreihen”,Norske Vid. Selsk. I Mat.-Natur. Kl. Skr., Christiania no. 1 (1912), 1–67.Google Scholar