Skip to main content

A New Algorithm for Efficient Pattern Matching with Swaps

  • Conference paper
Combinatorial Algorithms (IWOCA 2009)

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

Included in the following conference series:

Abstract

The Pattern Matching problem with Swaps consists in finding all occurrences of a pattern P in a text T, when disjoint local swaps in the pattern are allowed.

In this paper, we present a new efficient algorithm for the Swap Matching problem with short patterns. In particular, we devise a \(\mathcal{O}(nm^2)\) general algorithm, named Backward-Cross-Sampling, and show an efficient implementation of it, based on bit-parallelism, which achieves \(\mathcal{O}(nm)\) worst-case time and \(\mathcal{O}(\sigma)\)-space complexity, with patterns whose length m is comparable to the word-size of the target machine (n and σ are respectively the size of the text and of the alphabet).

From an extensive comparison with some of the most recent and effective algorithms for the swap matching problem, it turns out that our algorithm is very flexible and achieves very good results in practice.

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

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Amir, A., Aumann, Y., Landau, G.M., Lewenstein, M., Lewenstein, N.: Pattern matching with swaps. In: IEEE Symposium on Foundations of Computer Science, pp. 144–153 (1997)

    Google Scholar 

  2. Amir, A., Aumann, Y., Landau, G.M., Lewenstein, M., Lewenstein, N.: Pattern matching with swaps. Journal of Algorithms 37(2), 247–266 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  3. Amir, A., Cole, R., Hariharan, R., Lewenstein, M., Porat, E.: Overlap matching. Inf. Comput. 181(1), 57–74 (2003)

    Article  MATH  MathSciNet  Google Scholar 

  4. Amir, A., Landau, G.M., Lewenstein, M., Lewenstein, N.: Efficient special cases of pattern matching with swaps. Information Processing Letters 68(3), 125–132 (1998)

    Article  MathSciNet  Google Scholar 

  5. Antoniou, P., Iliopoulos, C.S., Jayasekera, I., Rahman, M.S.: Implementation of a swap matching algorithm using a graph theoretic model. In: Elloumi, M., et al. (eds.) BIRD 2008. CCIS, vol. 13, pp. 446–455. Springer, Heidelberg (2008)

    Google Scholar 

  6. Baeza-Yates, R., Gonnet, G.H.: A new approach to text searching. Commun. ACM 35(10), 74–82 (1992)

    Article  Google Scholar 

  7. Cantone, D., Faro, S.: Pattern matching with swaps for short patterns in linear time. In: Nielsen, M., et al. (eds.) SOFSEM 2009. LNCS, vol. 5404, pp. 255–266. Springer, Heidelberg (2009)

    Google Scholar 

  8. Crochemore, M., Rytter, W.: Text algorithms. Oxford University Press, Oxford (1994)

    MATH  Google Scholar 

  9. Iliopoulos, C.S., Rahman, M.S.: A new model to solve the swap matching problem and efficient algorithms for short patterns. In: Geffert, V., Karhumäki, J., Bertoni, A., Preneel, B., Návrat, P., Bieliková, M. (eds.) SOFSEM 2008. LNCS, vol. 4910, pp. 316–327. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  10. Muthukrishnan, S.: New results and open problems related to non-standard stringology. In: Galil, Z., Ukkonen, E. (eds.) CPM 1995. LNCS, vol. 937, pp. 298–317. Springer, Heidelberg (1995)

    Google Scholar 

  11. Navarro, G., Raffinot, M.: A bit-parallel approach to suffix automata: Fast extended string matching. In: Farach-Colton, M. (ed.) CPM 1998. LNCS, vol. 1448, pp. 14–33. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2009 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Campanelli, M., Cantone, D., Faro, S. (2009). A New Algorithm for Efficient Pattern Matching with Swaps. In: Fiala, J., Kratochvíl, J., Miller, M. (eds) Combinatorial Algorithms. IWOCA 2009. Lecture Notes in Computer Science, vol 5874. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-10217-2_24

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-10217-2_24

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-10216-5

  • Online ISBN: 978-3-642-10217-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics