Re: c-strstr: add testcase

2007-02-11 Thread Bruno Haible
Now here's the fix that brings the worst-case complexity down from O(n*m) to O(n). One could use either the Knuth-Morris-Pratt or the Boyer-Moore algorithm. I'm using the former one, because Boyer-Moore works "backwards", which is harder to generalize to the mbsstr case. 2007-02-11 Bruno Haible

Re: c-strstr: add testcase

2007-02-11 Thread Bruno Haible
The "check that the asymptotic worst-case complexity is not quadratic" fails: it takes eternities. I'm therefore going to add a catch for worst-case linear complexity. This is impossible with the current over- optimized 'goto' spaghetti implementation, so I'm replacing it with a maintainable implem