Sign in to follow this  
random_thinker

c++ : std::string.find() what is the base algorithm...Boyer-Moore?

Recommended Posts

Just wondering what the std::string.find() algorithm is base upon? Noted in another thread that Boyer-Moore is highly recommended for string finding. Can't find this info in my references or on the 'net. Anyone know? --random_thinker

Share this post


Link to post
Share on other sites
It is implementation-defined. The C++ standard only mandates interface and asymptotic performance, not actual algorithms and implementations. Considering that the full source code for std::string is available, you could check by yourself how your standard library implementation does it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Fruny
It is implementation-defined. The C++ standard only mandates interface and asymptotic performance, not actual algorithms and implementations. Considering that the full source code for std::string is available, you could check by yourself how your standard library implementation does it.


Why do implementations vary, because of the compiler or platform?

--random_thinker

Share this post


Link to post
Share on other sites
Some vendors may want to optimize for code space, others may choose to optimize for runtime performance. New algorithms may come along that are better than old ones, and so on.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
Some vendors may want to optimize for code space, others may choose to optimize for runtime performance. New algorithms may come along that are better than old ones, and so on.


I'm trying to stick with a relatively recent version of g++ (3.3.5). Should the algorithms be more-or-less the same regardless of platform?
--random_thinker

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this