Locally Maximal Common Factors as a Tool for Efficient Dynamic String Algorithms

Authors Amihood Amir, Itai Boneh

Thumbnail PDF


  • Filesize: 457 kB
  • 13 pages

Document Identifiers

Author Details

Amihood Amir
  • Bar-Ilan University and Johns Hopkins University
Itai Boneh
  • Bar-Ilan University

Cite AsGet BibTex

Amihood Amir and Itai Boneh. Locally Maximal Common Factors as a Tool for Efficient Dynamic String Algorithms. In 29th Annual Symposium on Combinatorial Pattern Matching (CPM 2018). Leibniz International Proceedings in Informatics (LIPIcs), Volume 105, pp. 11:1-11:13, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2018)


There has been recent interest in dynamic string algorithms, i.e. string problems where the input changes dynamically. One such problem is the longest common factor (LCF) problem. It is well known that the LCF of two strings S and D of length n over a fixed constant-sized alphabet Sigma can be computed in time linear in n. Recently, a new challenge was introduced - finding the LCF of two strings in a dynamic setting. The problem is the fully dynamic one sided LCF (FDOS-LCF) problem. In the FDOS-LCF problem we get q consecutive queries of the form <i,alpha >, where each such query means: "replace D[i] by alpha, alpha in Sigma and output the LCF of S and (the updated) D. The goal is to initially preprocess S and D so that we do not need O(n) time to compute an LCF for each such query. The state-of-the-art is an algorithm that preprocesses the two strings S and D in time O(n log^4 n). Subsequently, the algorithm answers in time O(log^3 n) a single query of the form: Given a position i on D and a letter alpha, return an LCF of S and D', where D' is the string resulting from D after substituting D[i] with alpha. That algorithm is not extendable to multiple queries. In this paper we present a tool - Locally Maximal Common Factors (LMCF) - that proves to be quite useful in solving some restricted versions of the FDOS-LCF problem . The versions we solve are the Decremental FDOS-LCS problem, where every change <i,alpha> is of the form <i,omega>, omega !in Sigma, and the Periodic FDOS-LCS problem, where S is a periodic string with period length p. For the decremental problem we provide an algorithm with linear time preprocessing and O(log log n) time per query. For the periodic problem our preprocessing time is linear and the query time is O(p log log n).

Subject Classification

ACM Subject Classification
  • Theory of computation → Pattern matching
  • Theory of computation → Dynamic graph algorithms
  • Dynamic Algorithms
  • Periodicity
  • Longest Common Factor
  • Priority Queue Data Structures
  • Suffix Tree
  • Balanced Search Tree
  • Range Maximum Queries


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. A. Amir, P. Charalampopoulos, C.S. Iliopoulos, S.P. Pissis, and J. Radoszewski. Longest common factor after one edit operation. In Proc. 24th International Symposium on String Processing and Information Retrieval (SPIRE), LNCS, pages 14-26. Springer, 2017. best paper award. Google Scholar
  2. M.A. Babenko and T.A. Starikovskaya. Computing the longest common substring with one mismatch. Probl. Inf. Transm., 47(1):28-33, 2011. Google Scholar
  3. O. Berkman and U. Vishkin. Finding level-ancestors in trees. Journal of Computer and System Sciences, 48(2):214-229, 1994. Google Scholar
  4. M. Crochemore, C. Hancart, and T. Lecroq. Algorithms on Strings. Cambridge University Press, 2007. Google Scholar
  5. M. Farach. Optimal suffix tree construction with large alphabets. Proc. 38th IEEE Symposium on Foundations of Computer Science, pages 137-143, 1997. Google Scholar
  6. J. Fischer and V. Heun. Theoretical and practical improvements on the RMQ-problem, with applications to LCA and LCE. In Proc. 17th Annual Symposium on Combinatorial Pattern Matching (CPM), number 4009 in LNCS, pages 36-48. Springer-Verlag, 2006. Google Scholar
  7. T. Flouri, E. Giaquinta, K. Kobert, and E. Ukkonen. Longest common substrings with k mismatches. Information Processing Letters, 115(6-8):643-647, 2015. Google Scholar
  8. H. N. Gabow, J. L. Bentley, and R. E. Tarjan. Scaling and related techniques for geometry problems. Proc. 16th ACM Symposium on Theory of Computing, 67:135-143, 1984. Google Scholar
  9. S. Grabowski. A note on the longest common substrings with k mismatches problem. Information Processing Letters, 115(6-8):640-642, 2015. Google Scholar
  10. Dan Gusfield. Algorithms on Strings, Trees, and Sequences: Computer Science and Computational Biology. Cambridge University Press, 1997. Google Scholar
  11. C.-A. Leimeister and B. Morgenstern. KMACS: the k-mismatch average common substring approach to alignment-free sequence comparison. Bioinformatics, 30(14):2000-2008, 2014. Google Scholar
  12. E. M. McCreight. A space-economical suffix tree construction algorithm. J. of the ACM, 23:262-272, 1976. Google Scholar
  13. T. Starikovskaya. Longest common substrings with approximately k mismatches. In Proc. 27th Annual Symposium on Combinatorial Pattern Matching (CPM), volume 54 of LIPIcs, pages 21:1-21:11, 2016. Google Scholar
  14. E. Ukkonen. On-line construction of suffix trees. Algorithmica, 14:249-260, 1995. Google Scholar
  15. P. van Emde Boas, R. Kaas, and E. Zijlstra. Design and implementation of an efficient priority queue. Mathematical Systems Theory, 10:99-127, 1977. Google Scholar
  16. P. Weiner. Linear pattern matching algorithm. Proc. 14 IEEE Symposium on Switching and Automata Theory, pages 1-11, 1973. Google Scholar
  17. D. E. Willard. Log-logarithmic worst-case range queries are possible in space θ(n). Information Processing Letters, 17(2):81-84, 1983. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail