Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pattern Matching With Don’t Cares Clifford & Clifford’s Algorithm Orgad Keller.

Similar presentations


Presentation on theme: "Pattern Matching With Don’t Cares Clifford & Clifford’s Algorithm Orgad Keller."— Presentation transcript:

1 Pattern Matching With Don’t Cares Clifford & Clifford’s Algorithm Orgad Keller

2 Orgad Keller - Algorithms 2 - Further Reading 2 Input: A text, a pattern over alphabet ( is the don’t care symbol). Output: All locations where PM with Don’t Cares

3 Orgad Keller - Algorithms 2 - Further Reading 3 Known Solutions We’ve seen an algorithm for the binary alphabet case. For the general alphabet case, we had two options, both based on reductions to the binary case:  If we wanted only to find the matches, we had the Fischer-Paterson algorithm.  If we wanted mismatch count also, we had the Abrahamson-Kosaraju algorithm.

4 Orgad Keller - Algorithms 2 - Further Reading 4 New Solution Sometimes simpler is better! Raphaël and Peter Clifford came up with a much, much simpler PM with Don’t Cares algorithm in time.

5 Orgad Keller - Algorithms 2 - Further Reading 5 Let be a symbol from the pattern and be a symbol from the text. As mentioned, In our matching relation, iff: Idea

6 Orgad Keller - Algorithms 2 - Further Reading 6 Since we encode as 0, it’s like saying: Idea

7 Orgad Keller - Algorithms 2 - Further Reading 7 As mentioned, we seek All locations where As we’ve seen, that’s true iff: Idea

8 Orgad Keller - Algorithms 2 - Further Reading 8 We have a problem because, generally speaking: but the opposite is not true! On the other hand, if we know that then Problem

9 Orgad Keller - Algorithms 2 - Further Reading 9 So we can easily fix the problem:  Now: Problem

10 Orgad Keller - Algorithms 2 - Further Reading 10 To sum up, we got that: Problem left: How can we compute for all efficiently? Idea (cont’d)

11 Orgad Keller - Algorithms 2 - Further Reading 11 Computing Efficiently

12 Orgad Keller - Algorithms 2 - Further Reading 12 We can easily compute, and for all ‘s using FFT-based multiplication in time. Then we’ll return all locations where Convolutions

13 Orgad Keller - Algorithms 2 - Further Reading 13 Algorithm

14 Orgad Keller - Algorithms 2 - Further Reading 14 Most costly operations are 3 polynomial multiplications, so overall time is Running Time


Download ppt "Pattern Matching With Don’t Cares Clifford & Clifford’s Algorithm Orgad Keller."

Similar presentations


Ads by Google