Knuth-Morris-Pratt - PowerPoint PPT Presentation

About This Presentation
Title:

Knuth-Morris-Pratt

Description:

Knuth-Morris-Pratt. KMP algorithm. [over binary alphabet] Build DFA from pattern. ... – PowerPoint PPT presentation

Number of Views:146
Avg rating:3.0/5.0
Slides: 13
Provided by: kevin59
Category:
Tags: knuth | morris | pratt

less

Transcript and Presenter's Notes

Title: Knuth-Morris-Pratt


1
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
2
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
3
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
4
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
5
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
6
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
7
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
8
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
9
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
10
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
11
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
12
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
a
b
b
3
4
5
6
0
1
2
accept state
b
b
b
Write a Comment
User Comments (0)
About PowerShow.com