kranthikumar has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Boyer Moore algorithorithm
by kennethk (Abbot) on Feb 10, 2014 at 17:51 UTC
Re: Boyer Moore algorithm
by Old_Gray_Bear (Bishop) on Feb 10, 2014 at 17:48 UTC
    Certainly.

    My billing rate is $60(US) per hour with a four hour minimum. Once your check clears, I'll get right on it.

    ----
    I Go Back to Sleep, Now.

    OGB

      $60? You're cheap!

      Three thousand years of beautiful tradition, from Moses to Sandy Koufax, you're god damn right I'm living in the fucking past

        heh. that's what I came here to say.
Re: Boyer Moore algorithm
by oiskuu (Hermit) on Feb 10, 2014 at 22:04 UTC

    I've no doubt a friendly Nigerian Prince will fulfill the OP request in a short while.

    As far as string matching goes, I'd recommend the following: Exact String Matching Algorithms. Clear and concise description of the algorithms, their features, and implementation in C. Covers KP, MP, KMP, BM, Turbo-BM, Horspool, and many others.

    List of Thierry Lecroq publications for more on the same topic.

Re: Boyer Moore algorithm
by erix (Prior) on Feb 10, 2014 at 18:11 UTC

    Download PostgreSQL, build a server, and follow a string search in the debugger, e.g. select position('xy' in 'abcxydef');

    Hours of endless fun.

    Boyer–Moore–Horspool is used in postgresql string searches.

      Right, but the OP also wanted straight Boyer Moore. For that, they should point their debugger at perl and follow a fixed-string search in a regular expresion: Peep hole Optimisation and Analysis

      Please, try and be thorough in the future ;)


      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Re: Boyer Moore algorithm
by davido (Cardinal) on Feb 10, 2014 at 23:20 UTC

    Can you first explain what your intended use is?

    Using the regexp engine, you get Boyer-Moore when appropriate, automatically. And if for some reason you can't use the regexp engine, I would be surprised (though I haven't benchmarked) if a pure-Perl implementation of Boyer-Moore would beat Perl's native index (Update: which internally uses Boyer-Moore).


    Dave

      I would be surprised (though I haven't benchmarked) if a pure-Perl implementation of Boyer-Moore would beat Perl's native index.

      I have. It's not even in the same eon.

      And, whilst I won't dare to suggest my Inline::C implementation was perfect, even in C it didn't come close to beating index. The overhead of transitioning from Perl through Inline to C and back, wiped out any gains.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Boyer Moore algorithm
by karlgoethebier (Abbot) on Feb 10, 2014 at 18:42 UTC