1 / 9

String Matching: Knuth-Morris-Pratt algorithm

String Matching: Knuth-Morris-Pratt algorithm. Heather Takeguchi. What is String Matching?. Used in word find in document, as well as in the spell checker and in internet keyword searches Looking for an exact string match

daisy
Télécharger la présentation

String Matching: Knuth-Morris-Pratt algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. String Matching: Knuth-Morris-Pratt algorithm Heather Takeguchi

  2. What is String Matching? • Used in word find in document, as well as in the spell checker and in internet keyword searches • Looking for an exact string match • Reality of algorithms are more complicated; search string ‘string’ results in ‘String’ as well as ‘stringbean’

  3. How do you match strings? • Finite-State-Automota • Brute-Force • Knuth-Morris-Pratt (KMP) • visualization tool for Brute Force and KMP www.dcc.ufmg.br/~cassia/smaa/english/

  4. Virus Detection • Detection of virus is simply searching for a pattern string in a larger text. • ) viral signature (contagious seg.) matching • ) code enumeration (cmp. to old known file) • ) checksum methods (see size of file)

  5. Variation-tolerant matching • Fast substring matching • approximate string matching • voice recognition • dna sequencing

  6. Example: x = GATAA and y = CAGATAAGAGAA and k = 1

  7. Example: x = GATAA and y = CAGATAAGAGAA and k = 1

  8. Summary • Exact string matching good for grep & sed • String matching used in word find and in internet key word searches • KMP alg. is slightly better than Brute Force • approximate string matching and fast substring matching can be used for a wider use to practical applications.

  9. Acknowledgements • Virus detection: www.cse.uta.edu/~holder/courses/cse5311/lectures/applets/je/a24.html • Speech recognition: www.kom.e-technik.tu-darmstadt.de/pr/workshop/chair/ACMMM98/electronic_proceedings/robertson/ • Approximate string matching: http://www-igm.univ-mlv.fr/~lecroq/seqcomp/node3.html • Cormen, chaper 34

More Related