in reply to Re^2: Can KMP be used to find the longest common subsequence?
in thread Can KMP be used to find the longest common subsequence?
If that were to fail to match, then it would fail to match very badly, as in O(N**K) badly. Better:
/^[^a]*?a[^b]*?b[^c]*?c[^d]*?d/
or use features that I don't use and so don't remember to prevent backtracking. The above version should proceed to match the string linearly and in O(n) and, if that fails, backtrack linearly in O(n) and quickly fail.
- tye
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Can KMP be used to find the longest common subsequence? (ugh)
by bart (Canon) on Dec 12, 2007 at 11:46 UTC | |
by moritz (Cardinal) on Dec 12, 2007 at 12:08 UTC |