On Recognizing Words That Are Squares for the Shuffle Product

  • Romeo Rizzi
  • Stéphane Vialette
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7913)


The shuffle of two words u and v of A * is the language u ш v consisting of all words u 1 v 1 u 2 v 2u k v k , where k ≥ 0 and the u i and the v i are the words of A * such that u = u 1 u 2u k and v = v 1 v 2v k . A word u ∈ A * is a square for the shuffle product if it is the shuffle of two identical words (i.e., u ∈ v ш v for some v ∈ A *). Whereas, it can be tested in polynomial-time whether or not u ∈ v 1 ш v 2 for given words u, v 1 and v 2 [J.-C. Spehner, Le Calcul Rapide des Mélanges de Deux Mots, Theoretical Computer Science, 1986], we show in this paper that it is NP-complete to determine whether or not a word u is a square for the shuffle product. The novelty in our approach lies in representing words as linear graphs, in which deciding whether or not a given word is a square for the shuffle product reduces to computing some inclusion-free perfect matching.


Perfect Match Linear Graph Input Word Identical Letter Discrete Apply Mathematic 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Allauzen, C.: Calcul efficace du shuffle de k mots. Tech. rep., Institut Gaspard Monge, Universit Marne-la-Vallé (2000)Google Scholar
  2. 2.
    Aoki, H., Uehara, R., Yamazaki, K.: Expected length of longest common subsequences of two biased random strings and its application. Tech. Rep. 1185, RIMS Kokyuroku (2001)Google Scholar
  3. 3.
    Buss, S., Soltys, M.: Unshuffling a square is NP-hard (2012) (submitted)Google Scholar
  4. 4.
    Choffrut, C., Karhumäki, J.: Combinatorics of Words. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages. Springer (1997)Google Scholar
  5. 5.
    Iwama, K.: Personal communication (2012)Google Scholar
  6. 6.
    Warmutht, M.K., Haussler, D.: On the complexity of iterated shuffle. Journal of Computer and System Sciences 28(3), 345–358 (1984)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Downey, R., Fellows, M.: Parameterized Complexity. Springer (1999)Google Scholar
  8. 8.
    Erdong, C., Linji, Y., Hao, Y.: Improved algorithms for 2-interval pattern problem. Journal of Combinatorial Optimization 13, 263–275 (1983)Google Scholar
  9. 9.
    Iwama, K.: Unique decomposability of shuffled strings: A formal treatment of asynchronous time-multiplexed communication. In: Proc. 15th Annual ACM Symposium on Theory of Computing (STOC), Boston, Massachusetts, USA, pp. 374–381. ACM (1983)Google Scholar
  10. 10.
    Erickson, J.: How hard is unshuffling a string? Theoretical Computer Science, (version: 2010-12-01)
  11. 11.
    Kececioglu, J.D., Gusfield, D.: Reconstructing a history of recombinations from a set of sequences. Discrete Applied Mathematics 88(1-3), 239–260 (1998)MathSciNetzbMATHCrossRefGoogle Scholar
  12. 12.
    Kimura, T.: An algebraic system for process structuring and interprocess communication. In: Chandra, A., Wotschke, D., Friedman, E., Harrison, M.A. (eds.) Proc. 8th Annual ACM Symposium on Theory of Computing (STOC), Hershey, Pennsylvania, USA, pp. 92–100. ACM (1976)Google Scholar
  13. 13.
    van Leeuwen, J., Nivat, M.: Efficient recognition of rational relations. Information Processing Letters 14(1), 34–38 (1982)MathSciNetzbMATHCrossRefGoogle Scholar
  14. 14.
    Li, S., Li, M.: On two open problems of 2-interval patterns. Theoretical Computer Science 410(24-25), 2410–2423 (2009)MathSciNetzbMATHCrossRefGoogle Scholar
  15. 15.
    Lothaire, M.: Applied Combinatorics on Words. Encyclopedia of Mathematics and its Applications, vol. 105. Cambridge university press (2005)Google Scholar
  16. 16.
    Maier, D.: The complexity of some problems on subsequences and supersequences. Journal of the ACM 25(2), 322–336 (1978)MathSciNetzbMATHCrossRefGoogle Scholar
  17. 17.
    Mansfield, A.: On the computational complexity of a merge recognition problem. Discrete Applied Mathematics 5, 119–122 (1983)MathSciNetzbMATHCrossRefGoogle Scholar
  18. 18.
    Rampersad, D.H.N., Shallit, J.: Shuffling and unshuffling (2011),
  19. 19.
    Spehner, J.C.: Le calcul rapide des melanges de deux mots. In: Theoretical Computer Science pp. 171–203 (1986)Google Scholar
  20. 20.
    Vialette, S.: On the computational complexity of 2-interval pattern matching problems. Theoretical Computer Science 312(2-3), 223–249 (2004)MathSciNetzbMATHCrossRefGoogle Scholar
  21. 21.
    Vialette, S.: Two-interval pattern problems. In: Kao, M.Y. (ed.) Encyclopedia of Algorithms, pp. 985–989. Springer (2008)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Romeo Rizzi
    • 1
  • Stéphane Vialette
    • 2
  1. 1.Dipartimento di Matematica ed InformaticaUniversità degli Studi di UdineItaly
  2. 2.LIGM CNRS UMR 8049Université Paris-EstFrance

Personalised recommendations