Haskell Boyer-Moore Implementation not working

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 6611 Views - Last Post: 18 December 2012 - 02:59 PM

#16 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2153
  • View blog
  • Posts: 3,315
  • Joined: 21-June 11

Re: Haskell Boyer-Moore Implementation not working

Posted 18 December 2012 - 02:25 PM

One thing I find strange about your code is that findPosition returns -1 if the pattern is not found, but you never check for that.
Was This Post Helpful? 0
  • +
  • -

#17 Party Boy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 23-October 12

Re: Haskell Boyer-Moore Implementation not working

Posted 18 December 2012 - 02:53 PM

Oh yeah.
I can't seem to get it to work, what would be the correct way to use it?
I modified it to be this: http://hpaste.org/79491

But still no joy.
Was This Post Helpful? 0
  • +
  • -

#18 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2153
  • View blog
  • Posts: 3,315
  • Joined: 21-June 11

Re: Haskell Boyer-Moore Implementation not working

Posted 18 December 2012 - 02:56 PM

To be honest I'm not all that familiar with the algorithm and I don't really have a clear idea of what your code is doing (or what it should be doing) in some places. So I don't know where it's going wrong (or for that matter, where it's going right).
Was This Post Helpful? 0
  • +
  • -

#19 Party Boy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 23-October 12

Re: Haskell Boyer-Moore Implementation not working

Posted 18 December 2012 - 02:59 PM

No problem I appreciate the help with some of the stuff.

Boyer more basically checks what is similar in both Strings and moves the pattern strings similar element to the same element of the main string and then compares again.

http://www.prism.gat...ta3/boyermoore/

Good way to show it if you want to look at it.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2