Skip to main content

Duel and Sweep Algorithm for Order-Preserving Pattern Matching

  • Conference paper
  • First Online:
SOFSEM 2018: Theory and Practice of Computer Science (SOFSEM 2018)

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

Abstract

Given a text and a pattern over an alphabet, the classic exact matching problem searches for all occurrences of the pattern in the text. Unlike exact matching, order-preserving pattern matching (OPPM) considers the relative order of elements, rather t han their real values. In this paper, we propose an efficient algorithm for the OPPM problem using the “duel-and-sweep” paradigm. For a pattern of length m and a text of length n, our algorithm runs in \(O(n + m\log m)\) time in general, and in \(O(n + m)\) time under an assumption that the characters in a string can be sorted in linear time with respect to the string size. We also perform experiments and show that our algorithm is faster than the KMP-based algorithm.

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 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.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

Similar content being viewed by others

Notes

  1. 1.

    Similar arrays \(\textit{Prev}_S\) and \(\textit{Next}_S\) are introduced in [12].

  2. 2.

    Each of (5) and (6) of Lemma 2 involves four (in)equalities but checking three is enough thanks to the properties (3) and (4).

References

  1. Amir, A., Benson, G., Farach, M.: An alphabet independent approach to two-dimensional pattern matching. SIAM J. Comput. 23(2), 313–323 (1994)

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MATH  Google Scholar 

  3. Cantone, D., Faro, S., Külekci, M.O.: An efficient skip-search approach to the order-preserving pattern matching problem. In: PSC, pp. 22–35 (2015)

    Google Scholar 

  4. Chhabra, T., Külekci, M.O., Tarhio, J.: Alternative algorithms for order-preserving matching. In: PSC, pp. 36–46 (2015)

    Google Scholar 

  5. Chhabra, T., Tarhio, J.: A filtration method for order-preserving matching. Inf. Process. Lett. 116(2), 71–74 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  6. Cho, S., Na, J.C., Park, K., Sim, J.S.: A fast algorithm for order-preserving pattern matching. Inf. Process. Lett. 115(2), 397–402 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  7. Cole, R., Hazay, C., Lewenstein, M., Tsur, D.: Two-dimensional parameterized matching. ACM Trans. Algorithms 11(2), 12:1–12:30 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  8. Crochemore, M., Iliopoulos, C.S., Kociumaka, T., Kubica, M., Langiu, A., Pissis, S.P., Radoszewski, J., Rytter, W., Waleń, T.: Order-preserving indexing. Theor. Comput. Sci. Pattern Matching 638, 122–135 (2016). Text Data Structures and Compression

    Article  MathSciNet  MATH  Google Scholar 

  9. Davaajav, J.: A study on the two-dimensional order-preserving matching problem. Bachelor thesis, Tohoku University (2017)

    Google Scholar 

  10. Faro, S., Külekci, M.O.: Efficient algorithms for the order preserving pattern matching problem. In: Dondi, R., Fertin, G., Mauri, G. (eds.) AAIM 2016. LNCS, vol. 9778, pp. 185–196. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-41168-2_16

    Chapter  Google Scholar 

  11. Gusfield, D.: Algorithms on Strings, Trees and Sequences: Computer Science and Computational Biology. Cambridge University Press, Cambridge (1997)

    Book  MATH  Google Scholar 

  12. Hasan, M.M., Islam, A.S., Rahman, M.S., Rahman, M.S.: Order preserving pattern matching revisited. Pattern Recogn. Lett. 55, 15–21 (2015)

    Article  Google Scholar 

  13. Horspool, R.N.: Practical fast searching in strings. Softw. Pract. Experience 10(6), 501–506 (1980)

    Article  Google Scholar 

  14. Kim, J., Eades, P., Fleischer, R., Hong, S.H., Iliopoulos, C.S., Park, K., Puglisi, S.J., Tokuyama, T.: Order-preserving matching. Theor. Comput. Sci. 525, 68–79 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  15. Knuth, D.E., Morris Jr., J.H., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977)

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  17. Ueki, Y., Narisawa, K., Shinohara, A.: A fast order-preserving matching with \(q\)-neighborhood filtration using SIMD instructions. In: SOFSEM (Student Research Forum Papers/Posters), pp. 108–115 (2016)

    Google Scholar 

  18. Vishkin, U.: Optimal parallel pattern matching in strings. In: Brauer, W. (ed.) ICALP 1985. LNCS, vol. 194, pp. 497–508. Springer, Heidelberg (1985). https://doi.org/10.1007/BFb0015775

    Chapter  Google Scholar 

  19. Vishkin, U.: Deterministic sampling - a new technique for fast pattern matching. SIAM J. Comput. 20(1), 22–40 (1991)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgements

This work is supported by Tohoku University Division for Interdisciplinary Advance Research and Education, ImPACT Program of Council for Science, Technology and Innovation (Cabinet Office, Government of Japan), and JSPS KAKENHI Grant Number JP15H05706.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Davaajav Jargalsaikhan .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Jargalsaikhan, D., Diptarama, Ueki, Y., Yoshinaka, R., Shinohara, A. (2018). Duel and Sweep Algorithm for Order-Preserving Pattern Matching. In: Tjoa, A., Bellatreche, L., Biffl, S., van Leeuwen, J., Wiedermann, J. (eds) SOFSEM 2018: Theory and Practice of Computer Science. SOFSEM 2018. Lecture Notes in Computer Science(), vol 10706. Edizioni della Normale, Cham. https://doi.org/10.1007/978-3-319-73117-9_44

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-73117-9_44

  • Published:

  • Publisher Name: Edizioni della Normale, Cham

  • Print ISBN: 978-3-319-73116-2

  • Online ISBN: 978-3-319-73117-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics