Knuth morris pratt
Download
1 / 12

Knuth-Morris-Pratt - PowerPoint PPT Presentation


  • 63 Views
  • Uploaded on

Knuth-Morris-Pratt. KMP algorithm. [over binary alphabet] Build DFA from pattern. Run DFA on text. Search Text. a. a. a. b. a. a. b. a. a. a. b. a. a. b. a. a. a. b. a. a. a. a. a. b. a. b. 0. 1. 3. 4. 2. 5. 6. accept state. b. b. b.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Knuth-Morris-Pratt' - todd-boone


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Knuth morris pratt
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt1
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt2
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt3
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt4
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt5
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt6
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt7
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt8
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt9
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt10
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b


Knuth morris pratt11
Knuth-Morris-Pratt

  • KMP algorithm. [over binary alphabet]

    • Build DFA from pattern.

    • Run DFA on text.

Search Text

a

a

a

b

a

a

b

a

a

a

b

a

a

b

a

a

a

a

a

b

a

a

a

a

a

b

a

a

a

b

a

a

a

a

a

b

a

b

0

1

3

4

2

5

6

accept state

b

b

b