Does STL use Boyer-Moore?

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
BiK
Experienced poster
Posts: 104
Joined: Tue Sep 23, 2003 5:49 pm

Does STL use Boyer-Moore?

Post by BiK »

I have recently wondered whether the function for finding a substring of a string is efficiently implemented in STL? In other words, is one of the linear algorithms (Boyer-Moore, KMP or something else) used? Would somebody of you know?

Thanks
makbet
New poster
Posts: 44
Joined: Tue Nov 26, 2002 11:01 pm
Location: Wejherowo

Post by makbet »

I remember trying to solve this problem with STL on some Russian contest (acm.timus.ru or acm.sgu.ru), and I got time limit exceeded. I think all I found about the topic was that the average complexity of their algorithm is linear. So probably the worst case is not linear. I'm not sure though.
marian
New poster
Posts: 30
Joined: Sun Oct 27, 2002 4:01 pm
Contact:

Post by marian »

AFAIK, STL implementation included in gcc, doesn't use any sophisticated search algorithm. You can still check it out yourself in /usr/include/c++/ if you have it installed.
Post Reply

Return to “Algorithms”