Bubble-Flip—A New Generation Algorithm for Prefix Normal Words

  • Ferdinando Cicalese
  • Zsuzsanna Lipták
  • Massimiliano Rossi
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10792)


We present a new recursive generation algorithm for prefix normal words. These are binary words with the property that no factor has more 1s than the prefix of the same length. The new algorithm uses two operations on binary words, which exploit certain properties of prefix normal words in a smart way. We introduce infinite prefix normal words and show that one of the operations used by the algorithm, if applied repeatedly to extend the word, produces an ultimately periodic infinite word, which is prefix normal and whose period’s length and density we can predict from the original word.


Algorithms on automata and words Combinatorics on words Combinatorial generation Prefix normal words Infinite words Binary languages 



We wish to thank three anonymous referees, who read our paper very carefully and whose detailed comments contributed to improving its exposition.


  1. 1.
    Amir, A., Apostolico, A., Hirst, T., Landau, G.M., Lewenstein, N., Rozenberg, L.: Algorithms for jumbled indexing, jumbled border and jumbled square on run-length encoded strings. Theor. Comput. Sci. 656, 146–159 (2016)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Amir, A., Chan, T.M., Lewenstein, M., Lewenstein, N.: On hardness of jumbled indexing. In: Esparza, J., Fraigniaud, P., Husfeldt, T., Koutsoupias, E. (eds.) ICALP 2014. LNCS, vol. 8572, pp. 114–125. Springer, Heidelberg (2014). Google Scholar
  3. 3.
    Blondin Massé, A., de Carufel, J., Goupil, A., Lapointe, M., Nadeau, É., Vandomme, É.: Leaf realization problem, caterpillar graphs and prefix normal words. CoRR abs/1712.01942v1, previously part of CoRR abs/1709.09808 (2017)Google Scholar
  4. 4.
    Burcsi, P., Cicalese, F., Fici, G., Lipták, Zs.: Algorithms for jumbled pattern matching in strings. Int. J. Found. Comput. Sci. 23, 357–374 (2012)Google Scholar
  5. 5.
    Burcsi, P., Lipták, Zs., Fici, G., Ruskey, F., Sawada, J.: Normal, abby normal, prefix normal. In: Ferro, A., Luccio, F., Widmayer, P. (eds.) FUN 2014. LNCS, vol. 8496, pp. 74–88. Springer, Cham (2014).
  6. 6.
    Burcsi, P., Fici, G., Lipták, Zs., Ruskey, F., Sawada, J.: On combinatorial generation of prefix normal words. In: Kulikov, A.S., Kuznetsov, S.O., Pevzner, P. (eds.) CPM 2014. LNCS, vol. 8486, pp. 60–69. Springer, Cham (2014).
  7. 7.
    Burcsi, P., Fici, G., Lipták, Zs., Ruskey, F., Sawada, J.: On prefix normal words and prefix normal forms. Theor. Comput. Sci. 659, 1–13 (2017)Google Scholar
  8. 8.
    Chan, T.M., Lewenstein, M.: Clustered integer 3SUM via additive combinatorics. In: Proceedings of the 47th Annual ACM Symposium on Theory of Computing (STOC 2015), pp. 31–40 (2015)Google Scholar
  9. 9.
    Cicalese, F., Laber, E.S., Weimann, O., Yuster, R.: Approximating the maximum consecutive subsums of a sequence. Theor. Comput. Sci. 525, 130–137 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Fici, G., Lipták, Zs.: On prefix normal words. In: Mauri, G., Leporati, A. (eds.) DLT 2011. LNCS, vol. 6795, pp. 228–238. Springer, Heidelberg (2011).
  11. 11.
    Gagie, T., Hermelin, D., Landau, G.M., Weimann, O.: Binary jumbled pattern matching on trees and tree-like structures. Algorithmica 73(3), 571–588 (2015)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Giaquinta, E., Grabowski, S.: New algorithms for binary jumbled pattern matching. Inf. Process. Lett. 113(14–16), 538–542 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Knuth, D.: The Art of Computer Programming (TAOCP). Accessed 15 Dec 2017
  14. 14.
    Knuth, D.E.: The Art of Computer Programming, Volume 4, Fascicle 3: Generating All Combinations and Partitions. Addison-Wesley Professional, Boston (2005)zbMATHGoogle Scholar
  15. 15.
    Kociumaka, T., Radoszewski, J., Rytter, W.: Efficient indexes for jumbled pattern matching with constant-sized alphabet. Algorithmica 77(4), 1194–1215 (2017)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Lothaire, M.: Algebraic Combinatorics on Words. Cambridge University Press, Cambridge (2002)CrossRefzbMATHGoogle Scholar
  17. 17.
    Moosa, T.M., Rahman, M.S.: Sub-quadratic time and linear space data structures for permutation matching in binary strings. J. Discret. Alg. 10, 5–9 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Ruskey, F., Sawada, J., Williams, A.: Binary bubble languages and cool-lex order. J. Comb. Theory Ser. A 119(1), 155–169 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Ruskey, F., Sawada, J., Williams, A.: De Bruijn sequences for fixed-weight binary strings. SIAM J. Discret. Math. 26(2), 605–617 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Sawada, J., Williams, A.: Efficient oracles for generating binary bubble languages. Electr. J. Comb. 19(1), P42 (2012)Google Scholar
  21. 21.
    Sawada, J., Williams, A., Wong, D.: Inside the binary reflected Gray code: Flip-Swap languages in 2-Gray code order. Unpublished manuscript (2017)Google Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Dipartimento di InformaticaUniversity of VeronaVeronaItaly

Personalised recommendations