string::find complexity.

Jason Merrill jason@redhat.com
Thu Jun 10 15:22:00 GMT 2004


On 10 Jun 2004 11:35:51 +0530, Dhruv Matani <dhruvbird@gmx.net> wrote:

> I wanted to know why the string::find(string pos, n) function is
> implemented as O(n^2), instead of the KMP algorithm which is much faster?

Presumably because I wasn't aware of the KMP algorithm when I wrote the
first implementation of the string class, and nobody has submitted a patch
to improve it.

Jason



More information about the Libstdc++ mailing list