开发者

How to solve the 2D matching problem with pattern matching with don't cares?

I think I understand the Fisch开发者_StackOverflow中文版er & Paterson algorithm for pattern matching with "don't cares" shown here: http://u.cs.biu.ac.il/~amir/AlgII/fp-set1.html

However, as I understood it is possible to use the "don't cares" one-dimensional matching to solve the two-dimensional matching in O((n^2)(logm)) time. For that, a "don't care" symbol should be appened to the end of each string or something like that and converting this to a one-dimensional problem. That's the part I don't really understand. I've made a few attempts but I can't see how that helps.

So, how does 1D-matching with "don't cares" helps solve 2D-matching?

Thanks.

EDIT: I think I sort of get it. The text needs to be linearized (concatenation of its rows). Same goes for the pattern but after each row, n-m don't-care symbols should be added (except for the last row of the pattern). Yet, I think this gets O((n^2)(log(m^2))) time and I think the previously mentioned time is not possible. Comments?


Note that log m2 = 2 log m, so your time bound in fact is equivalent to O(n2 log m).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜