Skip to main content

Fast Multiple Pattern Cartesian Tree Matching

  • Conference paper
  • First Online:
WALCOM: Algorithms and Computation (WALCOM 2020)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 12049))

Included in the following conference series:

  • 524 Accesses

Abstract

Cartesian tree matching is the problem of finding all substrings in a given text which have the same Cartesian trees as that of a given pattern. In this paper, we deal with Cartesian tree matching for the case of multiple patterns. We present two fingerprinting methods, i.e., the parent-distance encoding and the binary encoding. By combining an efficient fingerprinting method and a conventional multiple string matching algorithm, we can efficiently solve multiple pattern Cartesian tree matching. We propose three practical algorithms for multiple pattern Cartesian tree matching based on the Wu-Manber algorithm, the Rabin-Karp algorithm, and the Alpha Skip Search algorithm, respectively. In the experiments we compare our solutions against the previous algorithm [18]. Our solutions run faster than the previous algorithm as the pattern lengths increase. Especially, our algorithm based on Wu-Manber runs up to 33 times faster.

A full version of this paper is available at https://arxiv.org/abs/1911.01644. Gu, Song, and Park were supported by Collaborative Genome Program for Fostering New Post-Genome industry through the National Research Foundation of Korea (NRF) funded by the Ministry of Science ICT and Future Planning (No. NRF-2014M3C9A3063541).

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 74.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Aho, A.V., Corasick, M.J.: Efficient string matching: an aid to bibliographic search. Commun. ACM 18(6), 333–340 (1975)

    Article  MathSciNet  Google Scholar 

  2. Berkman, O., Schieber, B., Vishkin, U.: Optimal doubly logarithmic parallel algorithms based on finding all nearest smaller values. J. Algorithms 14(3), 344–370 (1993)

    Article  MathSciNet  Google Scholar 

  3. Boyer, R.S., Moore, J.S.: A fast string searching algorithm. Commun. ACM 20(10), 762–772 (1977)

    Article  Google Scholar 

  4. Charras, C., Lecroq, T., Pehoushek, J.D.: A very fast string matching algorithm for small alphabets and long patterns. In: Farach-Colton, M. (ed.) CPM 1998. LNCS, vol. 1448, pp. 55–64. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0030780

    Chapter  Google Scholar 

  5. Chhabra, T., Tarhio, J.: Order-preserving matching with filtration. In: Gudmundsson, J., Katajainen, J. (eds.) SEA 2014. LNCS, vol. 8504, pp. 307–314. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-07959-2_26

    Chapter  Google Scholar 

  6. Commentz-Walter, B.: A string matching algorithm fast on the average. In: Maurer, H.A. (ed.) ICALP 1979. LNCS, vol. 71, pp. 118–132. Springer, Heidelberg (1979). https://doi.org/10.1007/3-540-09510-1_10

    Chapter  Google Scholar 

  7. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to algorithms second edition. The Knuth-Morris-Pratt Algorithm (2001)

    Google Scholar 

  8. Crochemore, M., Czumaj, A., Gasieniec, L., Lecroq, T., Plandowski, W., Rytter, W.: Fast practical multi-pattern matching. Inf. Process. Lett. 71(3–4), 107–113 (1999)

    Article  MathSciNet  Google Scholar 

  9. Ganguly, A., Hon, W.K., Sadakane, K., Shah, R., Thankachan, S.V., Yang, Y.: Space-efficient dictionaries for parameterized and order-preserving pattern matching. In: 27th Annual Symposium on Combinatorial Pattern Matching (CPM), pp. 2:1–2:12. LIPIcs (2016)

    Google Scholar 

  10. Han, M., Kang, M., Cho, S., Gu, G., Sim, J.S., Park, K.: Fast multiple order-preserving matching algorithms. In: Lipták, Z., Smyth, W.F. (eds.) IWOCA 2015. LNCS, vol. 9538, pp. 248–259. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-29516-9_21

    Chapter  MATH  Google Scholar 

  11. Hua, N., Song, H., Lakshman, T.: Variable-stride multi-pattern matching for scalable deep packet inspection. In: IEEE INFOCOM 2009, pp. 415–423. IEEE (2009)

    Google Scholar 

  12. Karp, R.M., Rabin, M.O.: Efficient randomized pattern-matching algorithms. IBM J. Res. Dev. 31(2), 249–260 (1987)

    Article  MathSciNet  Google Scholar 

  13. Kim, J., et al.: Order-preserving matching. Theor. Comput. Sci. 525, 68–79 (2014)

    Article  MathSciNet  Google Scholar 

  14. Knuth, D.E.: The Art of Computer Programming, volume 2: Seminumerical algorithms. Addison-Wesley Professional, Boston (2014)

    Google Scholar 

  15. Kubica, M., Kulczyński, T., Radoszewski, J., Rytter, W., Waleń, T.: A linear time algorithm for consecutive permutation pattern matching. Inf. Process. Let. 113(12), 430–433 (2013)

    Article  MathSciNet  Google Scholar 

  16. Liao, H.J., Lin, C.H.R., Lin, Y.C., Tung, K.Y.: Intrusion detection system: a comprehensive review. J. Netw. Comput. Appl. 36(1), 16–24 (2013)

    Article  Google Scholar 

  17. Liu, J.N., Kwong, R.W.: Automatic extraction and identification of chart patterns towards financial forecast. Appl. Soft Comput. 7(4), 1197–1208 (2007)

    Article  Google Scholar 

  18. Park, S., Amir, A., Landau, G.M., Park, K.: Cartesian tree matching and indexing. In: 30th Annual Symposium on Combinatorial Pattern Matching (CPM), pp. 16:1–16:14. LIPIcs (2019)

    Google Scholar 

  19. Song, S., Ryu, C., Faro, S., Lecroq, T., Park, K.: Fast cartesian tree matching. In: Brisaboa, N.R., Puglisi, S.J. (eds.) SPIRE 2019. LNCS, vol. 11811, pp. 124–137. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-32686-9_9

    Chapter  Google Scholar 

  20. Song, T., Zhang, W., Wang, D., Xue, Y.: A memory efficient multiple pattern matching architecture for network security. In: IEEE INFOCOM 2008-The 27th Conference on Computer Communications, pp. 166–170. IEEE (2008)

    Google Scholar 

  21. Vuillemin, J.: A unifying look at data structures. Commun. ACM 23(4), 229–239 (1980)

    Article  MathSciNet  Google Scholar 

  22. Wu, S., Manber, U.: A fast algorithm for multi-pattern searching. Technical report. TR-94-17, Department of Computer Science, University of Arizona (1994)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Kunsoo Park .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Gu, G., Song, S., Faro, S., Lecroq, T., Park, K. (2020). Fast Multiple Pattern Cartesian Tree Matching. In: Rahman, M., Sadakane, K., Sung, WK. (eds) WALCOM: Algorithms and Computation. WALCOM 2020. Lecture Notes in Computer Science(), vol 12049. Springer, Cham. https://doi.org/10.1007/978-3-030-39881-1_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-39881-1_10

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-39880-4

  • Online ISBN: 978-3-030-39881-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics