Skip to main content

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1974))

Abstract

Let a text string T of n symbols and a pattern string P of m symbols from alphabet ∑ be given. A swapped version P′ of P is a length m string derived from P by a series of local swaps, (i.e. p′ p +1 and p ′ℓ+1 ← p) where each element can participate in no more than one swap. The Pattern Matching with Swaps problem is that of finding all locations i of T for which there exists a swapped version P′ of P with an exact matching of P′ in location i of T.

Recently, some efficient algorithms were developed for this problem. Their time complexity is better than the best known algorithms for pattern matching with mismatches. However, the Approximate Pattern Matching with Swaps problem was not known to be solved faster than the pattern matching with mismatches problem.

In the Approximate Pattern Matching with Swaps problem the output is, for every text location i where there is a swapped match of P, the number of swaps necessary to create the swapped version that matches location i. The fastest known method to-date is that of counting mismatches and dividing by two. The time complexity of this method is \( O(n\sqrt {m\log m} )\) for a general alphabet ∑.

In this paper we show an algorithm that counts the number of swaps at every location where there is a swapped matching in time O(n log m log σ), where σ = min(m, ∣∑∣). Consequently, the total time for solving the approximate pattern matching with swaps problem is O(f(n,m) +n log m log σ), where f(n,m) is the time necessary for solving the pattern matching with swaps problem.

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. K. Abrahamson. Generalized string matching. SIAM J. Comp., 16(6):1039–1051, 1987.

    Article  MATH  MathSciNet  Google Scholar 

  2. A. Amir, Y. Aumann, G. Landau, M. Lewenstein, and N. Lewenstein. Pattern matching with swaps. Submitted for publication.

    Google Scholar 

  3. A. Amir, Y. Aumann, G. Landau, M. Lewenstein, and N. Lewenstein. Pattern matching with swaps. Proc. 38th IEEE FOCS, 144–153, 1997.

    Google Scholar 

  4. A. Amir and M. Farach. Efficient 2-dimensional approximate matching of halfrectangular figures. Information and Computation, 118(1):1–11, April 1995.

    Article  MATH  MathSciNet  Google Scholar 

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

    Article  MathSciNet  Google Scholar 

  6. R. Cole and R. Harihan. Randomized swap matching in o(m log m log ∣σ∣) time. Technical Report TR1999–789, New York University, Courant Institute, September 1999.

    Google Scholar 

  7. R. Cole and R. Hariharan. Approximate string matching: A faster simpler algorithm. In Proc. 9th ACM-SIAM Symposium on Discrete Algorithms (SODA), 463–472, 1998.

    Google Scholar 

  8. M. J. Fischer and M. S. Paterson. String matching and other products. Complexity of Computation, R. M. Karp (editor), SIAM-AMS Proceedings, 7:113–125, 1

    Google Scholar 

  9. Z. Galil and K. Park. An improved algorithm for approximate string matching. SIAM J. Comp., 19(6):989–999, 1990.

    Article  MATH  MathSciNet  Google Scholar 

  10. D. E. Knuth, J. H. Morris, and V. R. Pratt. Fast pattern matching in strings. SIAM J. Comp., 6:323–350, 1977.

    Article  MATH  MathSciNet  Google Scholar 

  11. G. M. Landau and U. Vishkin. Fast parallel and serial approximate string matching. Journal of Algorithms, 10(2):157–169, 1989.

    Article  MATH  MathSciNet  Google Scholar 

  12. G. M. Landau, E. W. Myers, and J. P. Schmidt. Incremental string comparison. SIAM J. Comp., 27(2):557–582, 1998.

    Article  MATH  MathSciNet  Google Scholar 

  13. V. I. Levenshtein. Binary codes capable of correcting, deletions, insertions and reversals. Soviet Phys. Dokl., 10:707–710, 1966.

    MathSciNet  Google Scholar 

  14. R. Lowrance and R. A. Wagner. An extension of the string-to-string correction problem. J. of the ACM, 177–183, 1975.

    Google Scholar 

  15. S. Muthukrishnan and H. Ramesh. String matching under a general matching relation. Information and Computation, 122(1):140–148, 1995.

    Article  MATH  MathSciNet  Google Scholar 

  16. J. Naor and M. Naor. Small-bias probability spaces: Efficient constructions and applications. SIAM J. Comp., 838–856, 1993.

    Google Scholar 

  17. M. V. Olson. A time to sequence. Science, 270:394–396, 1995.

    Article  Google Scholar 

  18. A. Pentland. Invited talk. NSF Institutional Infrastructure Workshop, 1992.

    Google Scholar 

  19. R. A. Wagner. On the complexity of the extended string-to-string correction problem. In Proc. 7th ACM STOC, 218–223, 1975.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2000 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Amir, A., Lewenstein, M., Porat, E. (2000). Approximate Swapped Matching. In: Kapoor, S., Prasad, S. (eds) FST TCS 2000: Foundations of Software Technology and Theoretical Computer Science. FSTTCS 2000. Lecture Notes in Computer Science, vol 1974. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44450-5_24

Download citation

  • DOI: https://doi.org/10.1007/3-540-44450-5_24

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-41413-1

  • Online ISBN: 978-3-540-44450-3

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics