Abstract
Let two static sequences of strings P and S, representing prefix and suffix conditions respectively, be given as input for preprocessing. For the query, let two positive integers \(k_1\) and \(k_2\) be given, as well as a string T given in an online manner, such that \(T_i\) represents the length-i prefix of T for \(1 \le i \le |T|\). In this paper we are interested in computing the set \( ans_i \) of distinct substrings w of \(T_i\) such that \(k_1 \le |w| \le k_2\), and w contains some \(p \in P\) as a prefix and some \(s \in S\) as a suffix. More specifically, the counting problem is to output \(| ans_i |\), whereas the reporting problem is to output all elements of \( ans_i \), for each iteration i. Let \(\sigma \) denote the alphabet size, and for a sequence of strings A, \(\Vert A\Vert =\sum _{u\in A}|u|\). Then, we show that after \(O((\Vert P\Vert +\Vert S\Vert )\log \sigma )\)-time preprocessing, the solutions for the counting and reporting problems for each iteration up to i can be output in \(O(|T_i| \log \sigma )\) and \(O(|T_i| \log \sigma + | ans_i |)\) total time. The preprocessing time can be reduced to \(O(\Vert P\Vert +\Vert S\Vert )\) for integer alphabets of size polynomial with regard to \(\Vert P\Vert +\Vert S\Vert \). Our algorithms have possible applications to network traffic classification.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Amir, A., Levy, A., Porat, E., Shalom, B.R.: Online recognition of dictionary with one gap. Inf. Comput. 275, 104633 (2020)
Baeza-Yates, R.A., Gonnet, G.H.: Fast text searching for regular expressions or automaton searching on tries. J. ACM (JACM) 43(6), 915–936 (1996)
Choi, Y.H., Jung, M.Y., Seo, S.W.: L+ 1-mwm: a fast pattern matching algorithm for high-speed packet filtering. In: IEEE INFOCOM 2008-The 27th Conference on Computer Communications, pp. 2288–2296. IEEE (2008)
Crochemore, M., Rytter, W.: Text algorithms. Maxime Crochemore (1994)
Dori, S., Landau, G.M.: Construction of Aho Corasick automaton in linear time for integer alphabets. In: Apostolico, A., Crochemore, M., Park, K. (eds.) Combinatorial Pattern Matching, pp. 168–177. Springer, Berlin Heidelberg, Berlin, Heidelberg (2005). https://doi.org/10.1007/11496656_15
Fuchino, T., Harada, T., Tanaka, K., Mikawa, K.: Acceleration of packet classification using adjacency list of rules. In: 2019 28th International Conference on Computer Communication and Networks (ICCCN) (2019). https://doi.org/10.1109/icccn.2019.8846923
Gusfield, D.: Algorithms on Strings, Trees, and Sequences - Computer Science and Computational Biology. Cambridge University Press (1997). https://doi.org/10.1017/cbo9780511574931
Kärkkäinen, J., Sanders, P., Burkhardt, S.: Linear work suffix array construction. J. ACM (JACM) 53(6), 918–936 (2006)
Kasai, T., Lee, G., Arimura, H., Arikawa, S., Park, K.: Linear-time longest-common-prefix computation in suffix arrays and its applications. In: Amir, A. (ed.) CPM 2001. LNCS, vol. 2089, pp. 181–192. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-48194-X_17
Kim, D.K., Sim, J.S., Park, H., Park, K.: Constructing suffix arrays in linear time. J. Discrete Algorithms 3(2), 126–142 (2005). https://doi.org/10.1016/j.jda.2004.08.019
Leonard, L., Tanaka, K.: Suffix tree-based linear algorithms for multiple prefixes, single suffix counting and listing problems (2022). https://doi.org/10.48550/ARXIV.2203.16908
Levy, A., Shalom, B.R.: Online parameterized dictionary matching with one gap. Theoret. Comput. Sci. 845, 208–229 (2020). https://doi.org/10.1016/j.tcs.2020.09.016
Makinen, V., Belazzougui, D., Cunial, F., Tomescu, A.I.: Genome-Scale Algorithm Design. Cambridge University Press, Cambridge, England (May (2015)
Manber, U., Baeza-Yates, R.: An algorithm for string matching with a sequence of don’t cares. Inf. Process. Lett. 37(3), 133–136 (1991). https://doi.org/10.1016/0020-0190(91)90032-D
Manber, U., Myers, G.: Suffix arrays: a new method for on-line string searches. SIAM J. Comput. 22(5), 935–948 (1993). https://doi.org/10.1137/0222058
Mikawa, K., Tanaka, K.: Run-based trie involving the structure of arbitrary bitmask rules. IEICE Trans. Inf. Syst. E98.D(6), 1206–1212 (2015). https://doi.org/10.1587/transinf.2013EDP7087
Pampapathi, R., Mirkin, B., Levene, M.: A suffix tree approach to anti-spam email filtering. Mach. Learn. 65(1), 309–338 (2006). https://doi.org/10.1007/s10994-006-9505-y
Ruiz, J., España, S., García, P.: Locally threshold testable languages in strict sense: application to the inference problem. In: Honavar, V., Slutzki, G. (eds.) ICGI 1998. LNCS, vol. 1433, pp. 150–161. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0054072
Sen, S., Spatscheck, O., Wang, D.: Accurate, scalable in-network identification of p2p traffic using application signatures. In: Proceedings of the 13th International Conference on World Wide Web, pp. 512–521. WWW 2004, Association for Computing Machinery, New York, NY, USA (2004). https://doi.org/10.1145/988672.988742
Shalom, B.R.: Parameterized dictionary matching and recognition with one gap. Theoret. Comput. Sci. 854, 1–16 (2021). https://doi.org/10.1016/j.tcs.2020.11.017
Tongaonkar, A.S.: Fast pattern-matching techniques for packet filtering. Ph.D. thesis, Stony Brook University (2004)
Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14(3), 249–260 (1995). https://doi.org/10.1007/BF01206331
Acknowledgements
This work was supported by JSPS KAKENHI Grant Numbers JP20H04141 (HB) and JP22H03551 (SI), and by JST PRESTO Grant Number JPMJPR1922 (SI).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Leonard, L., Inenaga, S., Bannai, H., Mieno, T. (2022). Online Algorithms for Finding Distinct Substrings with Length and Multiple Prefix and Suffix Conditions. In: Arroyuelo, D., Poblete, B. (eds) String Processing and Information Retrieval. SPIRE 2022. Lecture Notes in Computer Science, vol 13617. Springer, Cham. https://doi.org/10.1007/978-3-031-20643-6_3
Download citation
DOI: https://doi.org/10.1007/978-3-031-20643-6_3
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-20642-9
Online ISBN: 978-3-031-20643-6
eBook Packages: Computer ScienceComputer Science (R0)