Re: [algogeeks] Patterns in a String

2011-07-25 Thread nitesh
Complexity of KMP is O(m+n) :m = length of string, n=length of pattern..which in most cases is more than the complexity of suffix tree implementation -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit

Re: [algogeeks] Patterns in a String

2011-07-25 Thread nitesh
How about creating a suffix tree and proceeding. It will take O(n+k) time. n=length of pattern, k=number of occurrences. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/ms

Re: [algogeeks] Patterns in a String

2011-07-25 Thread rajeev bharshetty
Yup, Boyer Moore Algorithm will do . In that just keep a count on number of times a particular pattern gets matched in the text. Guys, Which algorithm do you think is better for String matching .Is it KMP or Boyer Moore ?? I think KMP is better ? On Mon, Jul 25, 2011 at 4:59 PM, hary rathor wrot

Re: [algogeeks] Patterns in a String

2011-07-25 Thread hary rathor
Boyer–Moore string search algorithmfor fastest search ever introduced -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@goo

Re: [algogeeks] Patterns in a String

2011-07-25 Thread Ankur Garg
Use KMP algorithm On Mon, Jul 25, 2011 at 4:47 PM, nitesh wrote: > Given a string, give an algo to find the number of occurrences of a > particular pattern > > Eg: > > Input: "bellatbellfordbelly" > Find the number of occurrences of pattern(or substring) "bell" in it.. > > -- > You received this

[algogeeks] Patterns in a String

2011-07-25 Thread nitesh
Given a string, give an algo to find the number of occurrences of a particular pattern Eg: Input: "bellatbellfordbelly" Find the number of occurrences of pattern(or substring) "bell" in it.. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.