A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for...
Transcript of A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for...
![Page 1: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/1.jpg)
A Fast Algorithm for Permutation Pattern MatchingBased on Alternating Runs
Marie-Louise Bruner and Martin Lackner
Vienna University of Technology
July 6, 2012SWAT 2012, Helsinki
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 1
![Page 2: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/2.jpg)
Permutation patterns
A permutation T (the text) contains P as a pattern if we can find asubsequence of T that is order-isomorphic to P.
Does 53142 contain 231 as a pattern?
X (342 is a matching)
Does 53142 contain 123 as a pattern?
�
Does 53142 contain 4231 as a pattern?
X (5342 is a matching)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 2
![Page 3: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/3.jpg)
Permutation patterns
A permutation T (the text) contains P as a pattern if we can find asubsequence of T that is order-isomorphic to P.
Does 53142 contain 231 as a pattern?
X (342 is a matching)
Does 53142 contain 123 as a pattern?
�
Does 53142 contain 4231 as a pattern?
X (5342 is a matching)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 2
![Page 4: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/4.jpg)
Permutation patterns
A permutation T (the text) contains P as a pattern if we can find asubsequence of T that is order-isomorphic to P.
Does 53142 contain 231 as a pattern?
X (342 is a matching)
Does 53142 contain 123 as a pattern?
�
Does 53142 contain 4231 as a pattern?
X (5342 is a matching)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 2
![Page 5: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/5.jpg)
Permutation patterns
A permutation T (the text) contains P as a pattern if we can find asubsequence of T that is order-isomorphic to P.
Does 53142 contain 231 as a pattern?
X (342 is a matching)
Does 53142 contain 123 as a pattern?
�
Does 53142 contain 4231 as a pattern?
X (5342 is a matching)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 2
![Page 6: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/6.jpg)
Permutation patterns
A permutation T (the text) contains P as a pattern if we can find asubsequence of T that is order-isomorphic to P.
Does 53142 contain 231 as a pattern?
X (342 is a matching)
Does 53142 contain 123 as a pattern?
�
Does 53142 contain 4231 as a pattern?
X (5342 is a matching)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 2
![Page 7: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/7.jpg)
Permutation patterns
A permutation T (the text) contains P as a pattern if we can find asubsequence of T that is order-isomorphic to P.
Does 53142 contain 231 as a pattern?
X (342 is a matching)
Does 53142 contain 123 as a pattern?
�
Does 53142 contain 4231 as a pattern?
X (5342 is a matching)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 2
![Page 8: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/8.jpg)
Permutation patterns
A permutation T (the text) contains P as a pattern if we can find asubsequence of T that is order-isomorphic to P.
Does 53142 contain 231 as a pattern?
X (342 is a matching)
Does 53142 contain 123 as a pattern?
�
Does 53142 contain 4231 as a pattern?
X (5342 is a matching)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 2
![Page 9: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/9.jpg)
Enumerative combinatorics
Theorem
The n-permutations that do not contain the pattern 123 are counted bythe n-th Catalan number.
The same holds for every other pattern of length 3.
Stanley-Wilf conjecture, shown by Marcus and Tardos (2004)
For every permutation P there is a constant c such that the number ofn-permutations that do not contain P as a pattern is bounded by cn.
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 3
![Page 10: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/10.jpg)
Enumerative combinatorics
Theorem
The n-permutations that do not contain the pattern 123 are counted bythe n-th Catalan number.The same holds for every other pattern of length 3.
Stanley-Wilf conjecture, shown by Marcus and Tardos (2004)
For every permutation P there is a constant c such that the number ofn-permutations that do not contain P as a pattern is bounded by cn.
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 3
![Page 11: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/11.jpg)
Enumerative combinatorics
Theorem
The n-permutations that do not contain the pattern 123 are counted bythe n-th Catalan number.The same holds for every other pattern of length 3.
Stanley-Wilf conjecture, shown by Marcus and Tardos (2004)
For every permutation P there is a constant c such that the number ofn-permutations that do not contain P as a pattern is bounded by cn.
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 3
![Page 12: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/12.jpg)
Permutation Pattern Matching
Permutation Pattern Matching (PPM)
Instance: A permutation T of length n (thetext) and a permutation P of lengthk ≤ n (the pattern).
Question: Is there a matching of P into T ?
1993 (Bose, Buss, Lubiw): PPM is in general NP-complete.
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 4
![Page 13: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/13.jpg)
Permutation Pattern Matching
Permutation Pattern Matching (PPM)
Instance: A permutation T of length n (thetext) and a permutation P of lengthk ≤ n (the pattern).
Question: Is there a matching of P into T ?
1993 (Bose, Buss, Lubiw): PPM is in general NP-complete.
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 4
![Page 14: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/14.jpg)
Tractable cases of PPM
I Pattern avoids both 3142 and 2413 O(kn4)
I P = 12 . . . k or P = k . . . 21 O(n log log n)
I P has length at most 4 O(n log n)
I Pattern and Text avoid 321 O(k2n6)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 5
![Page 15: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/15.jpg)
Tractable cases of PPM
I Pattern avoids both 3142 and 2413 O(kn4)
I P = 12 . . . k or P = k . . . 21 O(n log log n)
I P has length at most 4 O(n log n)
I Pattern and Text avoid 321 O(k2n6)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 5
![Page 16: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/16.jpg)
Tractable cases of PPM
I Pattern avoids both 3142 and 2413 O(kn4)
I P = 12 . . . k or P = k . . . 21 O(n log log n)
I P has length at most 4 O(n log n)
I Pattern and Text avoid 321 O(k2n6)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 5
![Page 17: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/17.jpg)
Tractable cases of PPM
I Pattern avoids both 3142 and 2413 O(kn4)
I P = 12 . . . k or P = k . . . 21 O(n log log n)
I P has length at most 4 O(n log n)
I Pattern and Text avoid 321 O(k2n6)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 5
![Page 18: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/18.jpg)
The general case
Anything better than theO∗(2n)
runtime of brute-force search?
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 6
![Page 19: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/19.jpg)
Parameterized Complexity Theory
Idea: confine the combinatorial explosion to a parameter of the input
Fixed-parameter tractability
A problem is fixed-parameter tractable with respect to a parameter k ifthere is a computable function f and an integer c such that there is analgorithm solving the problem in time O(f (k) · |I |c).
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 7
![Page 20: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/20.jpg)
Parameterized Complexity Theory
Idea: confine the combinatorial explosion to a parameter of the input
Fixed-parameter tractability
A problem is fixed-parameter tractable with respect to a parameter k ifthere is a computable function f and an integer c such that there is analgorithm solving the problem in time O(f (k) · |I |c).
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 7
![Page 21: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/21.jpg)
Alternating runs
1
8
12
4
7
11
6
32
9
5
10
1 8 12 (up), 4 (down), 7 11 (up), 6 3 2 (down), 9 (up), 5 (down), 10 (up)
Notation
run(π)...the number of alternating runs in π,
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 8
![Page 22: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/22.jpg)
Alternating runs
1
8
12
4
7
11
6
32
9
5
10
1 8 12 (up), 4 (down), 7 11 (up), 6 3 2 (down), 9 (up), 5 (down), 10 (up)
Notation
run(π)...the number of alternating runs in π,
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 8
![Page 23: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/23.jpg)
The alternating run algorithm
I Matching functions:Reduce the search space
I Dynamic programming algorithm:Checks for every matching function whether there is a compatiblematching
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 9
![Page 24: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/24.jpg)
Matching functions
Pattern P
↓ matching function ↓
Text T
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 10
![Page 25: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/25.jpg)
Matching functions - an example
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 11
![Page 26: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/26.jpg)
Matching functions - an example
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 11
![Page 27: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/27.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 28: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/28.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 29: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/29.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 30: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/30.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 31: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/31.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 32: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/32.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 33: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/33.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 34: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/34.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 35: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/35.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 36: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/36.jpg)
The algorithm - finding a matching
Pattern P Text T
2
3
1
4
1
8
12
4
7
11
6
32
9
5
10
F (1)
F (2)
F (3)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 12
![Page 37: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/37.jpg)
Runtime
Matching functions:√
2run(T )
Dynamic programming algorithm: O∗(1.2611run(T ))
In total: O∗(1.784run(T ))
→ This is a fixed-parameter tractable (FPT) algorithm,i.e. a runtime of f (k) · nc .
Since run(T ) ≤ n, we also obtain O∗(1.784n)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 13
![Page 38: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/38.jpg)
Runtime
Matching functions:√
2run(T )
Dynamic programming algorithm: O∗(1.2611run(T ))
In total: O∗(1.784run(T ))
→ This is a fixed-parameter tractable (FPT) algorithm,i.e. a runtime of f (k) · nc .
Since run(T ) ≤ n, we also obtain O∗(1.784n)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 13
![Page 39: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/39.jpg)
Runtime
Matching functions:√
2run(T )
Dynamic programming algorithm: O∗(1.2611run(T ))
In total: O∗(1.784run(T ))
→ This is a fixed-parameter tractable (FPT) algorithm,i.e. a runtime of f (k) · nc .
Since run(T ) ≤ n, we also obtain O∗(1.784n)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 13
![Page 40: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/40.jpg)
Runtime
Matching functions:√
2run(T )
Dynamic programming algorithm: O∗(1.2611run(T ))
In total: O∗(1.784run(T ))
→ This is a fixed-parameter tractable (FPT) algorithm,i.e. a runtime of f (k) · nc .
Since run(T ) ≤ n, we also obtain O∗(1.784n)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 13
![Page 41: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/41.jpg)
Alternating runs in the pattern run(P)
O∗(1.784run(T )) FPT, i.e. f (k) · nc
O∗(( n2
2run(P)
)run(P))XP, i.e. nf (k)
no FPT result possible (W[1]-hardness)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 14
![Page 42: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/42.jpg)
Alternating runs in the pattern run(P)
O∗(1.784run(T )) FPT, i.e. f (k) · nc
O∗(( n2
2run(P)
)run(P))XP, i.e. nf (k)
no FPT result possible (W[1]-hardness)
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 14
![Page 43: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/43.jpg)
Conclusion
Main results
I O∗(1.784run(T )) → FPT result
I O∗(1.784n) → fastest general algorithm
I W[1]-hardness for run(P)
Future workI PPM parameterized by some other parameter of P? By k = |P|?I Kernelization results
I Other permutation statistics of the text?
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 15
![Page 44: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/44.jpg)
Conclusion
Main results
I O∗(1.784run(T )) → FPT result
I O∗(1.784n) → fastest general algorithm
I W[1]-hardness for run(P)
Future workI PPM parameterized by some other parameter of P? By k = |P|?
I Kernelization results
I Other permutation statistics of the text?
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 15
![Page 45: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/45.jpg)
Conclusion
Main results
I O∗(1.784run(T )) → FPT result
I O∗(1.784n) → fastest general algorithm
I W[1]-hardness for run(P)
Future workI PPM parameterized by some other parameter of P? By k = |P|?I Kernelization results
I Other permutation statistics of the text?
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 15
![Page 46: A Fast Algorithm for Permutation Pattern Matching Based on ...€¦ · A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs Marie-Louise Bruner and Martin Lackner](https://reader033.fdocuments.net/reader033/viewer/2022043012/5fab37c687ac237f8e35ec58/html5/thumbnails/46.jpg)
Conclusion
Main results
I O∗(1.784run(T )) → FPT result
I O∗(1.784n) → fastest general algorithm
I W[1]-hardness for run(P)
Future workI PPM parameterized by some other parameter of P? By k = |P|?I Kernelization results
I Other permutation statistics of the text?
M.L. Bruner, M. Lackner A Fast Algorithm for PPM July 6, 2012 15