A Textbook Solution for Dynamic Strings (2403.13162v4)
Abstract: We consider the problem of maintaining a collection of strings while efficiently supporting splits and concatenations on them, as well as comparing two substrings, and computing the longest common prefix between two suffixes. This problem can be solved in optimal time $\mathcal{O}(\log N)$ whp for the updates and $\mathcal{O}(1)$ worst-case time for the queries, where $N$ is the total collection size [Gawrychowski et al., SODA 2018]. We present here a much simpler solution based on a forest of enhanced splay trees (FeST), where both the updates and the substring comparison take $\mathcal{O}(\log n)$ amortized time, $n$ being the lengths of the strings involved. The longest common prefix of length $\ell$ is computed in $\mathcal{O}(\log n + \log2\ell)$ amortized time. Our query results are correct whp. Our simpler solution enables other more general updates in $\mathcal{O}(\log n)$ amortized time, such as reversing a substring and/or mapping its symbols. We can also regard substrings as circular or as their omega extension.
- Pattern matching in dynamic texts. In Proc. 11th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 819–828, 2000.
- Repetition detection in a dynamic string. In Proc. 27th Annual European Symposium on Algorithms (ESA), pages 5:1–5:18, 2019.
- Longest common factor after one edit operation. In Proc. 24th Int’l Symposium on String Processing and Information Retrieval (SPIRE), pages 14–26, 2017.
- Dynamic and internal longest common substring. Algorithmica, 82(12):3707–3743, 2020.
- MARS: Improving multiple circular sequence alignment using refined sequences. BMC Genomics, 18(1):1–10, 2017.
- Genome rearrangements and sorting by reversals. In Proc. 34th Annual Symposium on Foundations of Computer Science (FOCS), pages 148–157, 1993.
- Ropes: An alternative to strings. Software Practice and Experience, 25(12):1315–1330, 1995.
- Computing the original eBWT faster, simpler, and with less memory. In Proc. 28th Int’l Symp. on String Processing and Information Retrieval (SPIRE), pages 129–142, 2021.
- r-Indexing the eBWT. In Proc. 28th Int’l Symposium on String Processing and Information Retrieval (SPIRE), pages 3–12, 2021.
- Alberto Caprara. Sorting by reversals is difficult. In Proc. 1st Annual Int’l Conference on Research in Computational Molecular Biology (RECOMB), pages 75–83, 1997.
- Improved approximation for breakpoint graph decomposition and sorting by reversals. Journal of Combinatorial Optimization, 6(2):157–182, 2002.
- Permutation patterns in genome rearrangement problems: The reversal model. Discrete Applied Mathematics, 279:34–48, 2020.
- Dynamic string alignment. In Proc. 31st Annual Symposium on Combinatorial Pattern Matching (CPM), pages 9:1–9:13, 2020.
- Approximate circular pattern matching. In Proc. 30th Annual European Symposium on Algorithms (ESA), pages 35:1–35:19, 2022.
- Upper and lower bounds for dynamic data structures on strings. In Proc. 35th Symposium on Theoretical Aspects of Computer Science (STACS), pages 22:1–22:14, 2018.
- Richard Cole. On the dynamic finger conjecture for splay trees. Part II: The proof. SIAM Journal on Computing, 30(1):44–85, 2000.
- Combinatorics of Genome Rearrangements. MIT Press, 2009.
- Longest substring palindrome after edit. In Proc. 29th Annual Symposium on Combinatorial Pattern Matching (CPM), pages 12:1–12:14, 2018.
- Optimal dynamic strings. CoRR, abs/1511.02612, 2015.
- Optimal dynamic strings. In Proc. 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1509–1528, 2018.
- Finding the cyclic covers of a string. In Proc. 17th International Conference and Workshops on Algorithms and Computation (WALCOM), pages 139–150, 2023.
- Circular sequence comparison: algorithms and applications. Algorithms for Molecular Biology, 11(1):1–14, 2016.
- Yijie Han. Improving the efficiency of sorting by reversals. In Proc. Int’l Conference on Bioinformatics & Computational Biology (BIOCOMP), pages 406–409, 2006.
- Transforming cabbage into turnip: Polynomial algorithm for sorting signed permutations by reversals. In Proc. 27th Annual ACM Symposium on Theory of Computing (STOC), pages 178–189, 1995.
- Linear-time computation of cyclic roots and cyclic covers of a string. In Proc. 34th Annual Symposium on Combinatorial Pattern Matching (CPM), pages 15:1–15:15, 2023.
- Efficient randomized pattern-matching algorithms. IBM Journal of Research and Development, 31(2):249–260, 1987.
- M. Lothaire. Applied Combinatorics on Words. Cambridge University Press, 2005.
- An extension of the Burrows-Wheeler transform. Theoretical Computer Science, 387(3):298–312, 2007.
- Maintaining dynamic sequences under equality tests in polylogarithmic time. Algorithmica, 17(2):183–198, 1997.
- Specializing ropes for ruby. In Proc. 15th Int’l Conf. on Managed Languages & Runtimes (ManLang), pages 10:1–10:7, 2018.
- Universal compressed text indexing. Theoretical Computer Science, 762:41–50, 2019.
- On the sorting by reversals and transpositions problem. Journal of Universal Computer Science, 23(9):868–906, 2017.
- Self-adjusting binary search trees. Journal of the ACM, 32(3):652–686, 1985.
- A binary recursive gcd algorithm. In Proc. 6th Int’l Symposium on Algorithmic Number Theory (ANTS), pages 411–425, 2004.
- Unique binary-search-tree representations and equality testing of sets and sequences. SIAM Journal on Computing, 23(1):24–44, 1994.
- Wojciech Szpankowski. A generalized suffix tree and its (un)expected asymptotic behaviors. SIAM Journal on Computing, 22(6):1176–1198, 1993.
- Longest Lyndon substring after edit. In Proc. 29th Annual Symposium on Combinatorial Pattern Matching (CPM), pages 19:1–19:10, 2018.
- The chromosome inversion problem. Journal of Theoretical Biology, 99:1–7, 1982.
- Zsuzsanna Lipták (24 papers)
- Francesco Masillo (7 papers)
- Gonzalo Navarro (121 papers)