Skip to main content

Online Algorithms for Finding Distinct Substrings with Length and Multiple Prefix and Suffix Conditions

  • Conference paper
  • First Online:
String Processing and Information Retrieval (SPIRE 2022)

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Amir, A., Levy, A., Porat, E., Shalom, B.R.: Online recognition of dictionary with one gap. Inf. Comput. 275, 104633 (2020)

    Google Scholar 

  2. 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)

    Article  MathSciNet  MATH  Google Scholar 

  3. 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)

    Google Scholar 

  4. Crochemore, M., Rytter, W.: Text algorithms. Maxime Crochemore (1994)

    Google Scholar 

  5. 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

    Chapter  Google Scholar 

  6. 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

  7. Gusfield, D.: Algorithms on Strings, Trees, and Sequences - Computer Science and Computational Biology. Cambridge University Press (1997). https://doi.org/10.1017/cbo9780511574931

  8. Kärkkäinen, J., Sanders, P., Burkhardt, S.: Linear work suffix array construction. J. ACM (JACM) 53(6), 918–936 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  9. 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

    Chapter  Google Scholar 

  10. 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

    Article  MathSciNet  MATH  Google Scholar 

  11. 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

  12. 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

    Article  MathSciNet  MATH  Google Scholar 

  13. Makinen, V., Belazzougui, D., Cunial, F., Tomescu, A.I.: Genome-Scale Algorithm Design. Cambridge University Press, Cambridge, England (May (2015)

    Book  Google Scholar 

  14. 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

    Article  MathSciNet  MATH  Google Scholar 

  15. 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

    Article  MathSciNet  MATH  Google Scholar 

  16. 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

    Article  Google Scholar 

  17. 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

    Article  Google Scholar 

  18. 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

    Chapter  Google Scholar 

  19. 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

  20. 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

    Article  MathSciNet  MATH  Google Scholar 

  21. Tongaonkar, A.S.: Fast pattern-matching techniques for packet filtering. Ph.D. thesis, Stony Brook University (2004)

    Google Scholar 

  22. Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14(3), 249–260 (1995). https://doi.org/10.1007/BF01206331

    Article  MathSciNet  MATH  Google Scholar 

Download references

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

Authors

Corresponding author

Correspondence to Laurentius Leonard .

Editor information

Editors and Affiliations

A Appendix

A Appendix

Below, we show the input sets that match the each of the application signatures described in [19] (Table 1).

Table 1. Input sets corresponding to application signatures

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics