Pattern Matching With Don’t Cares Clifford & Clifford’s Algorithm Orgad Keller Modified by Ariel Rosenfeld
Orgad Keller - Algorithms 2 - Further Reading PM with Don’t Cares Input: A text , a pattern over alphabet ( is the don’t care symbol). Output: All locations where Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Idea Let be a symbol from the pattern and be a symbol from the text. As mentioned, In our matching relation, iff: Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Idea we encode as 0, which is like saying: Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Idea As mentioned, we seek All locations where As we’ve seen, that’s true iff: Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Problem We have a problem because, generally speaking: but the opposite is not true! On the other hand, if we know that then Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Problem So we can easily fix the problem: Now: Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Idea (cont’d) To sum up, we got that: Problem left: How can we compute for all efficiently? Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Computing Efficiently Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Convolutions We can easily compute , and for all ‘s using FFT-based multiplication in time . Then we’ll return all locations where Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading
Orgad Keller - Algorithms 2 - Further Reading Running Time Most costly operations are 3 polynomial multiplications, so overall time is Orgad Keller - Algorithms 2 - Further Reading