Re: divide & conquer algorithm to implement string matching
- From: Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx>
- Date: Wed, 30 May 2007 16:43:46 +0200
misterio <giagimari@xxxxxxxxx> writes:
The real problem to correctly implement this algorithm is to find a
way to calculate the exact indices when applying the divide & conquer
approach,and tat is why in the previous implementation some of these
indices were missing.With the following code I solved this problem by
calculating a fake array dimension augmented by 2 units,and that gives
me the total coverage of the indices.Now the problem is that I need to
verify is this approach is too particular and in case how to extend it
to any lenght of the base string and the pattern to search.Now I'll
start to search a solution to this,but I think it should be possible
to find such a math formula if I maintain the divide sequence costant
(ie.dividing always by 2),or maybe it could be even possible that this
approach can work flowessly for any kind of lenghts,I still don't
know,I need to try.Anyway,in the meantime,this is the code :
(P. S. I simplified the printf code to print just the 1st index of
every sequence,so that you can see if there's one missing)
It's called "divide and conquer", not "divide by 2 and conquer".
--
__Pascal Bourguignon__ http://www.informatimago.com/
NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
.
- Follow-Ups:
- Re: divide & conquer algorithm to implement string matching
- From: misterio
- Re: divide & conquer algorithm to implement string matching
- References:
- divide & conquer algorithm to implement string matching
- From: misterio
- Re: divide & conquer algorithm to implement string matching
- From: Logan Shaw
- Re: divide & conquer algorithm to implement string matching
- From: misterio
- divide & conquer algorithm to implement string matching
- Prev by Date: Re: divide & conquer algorithm to implement string matching
- Next by Date: Re: divide & conquer algorithm to implement string matching
- Previous by thread: Re: divide & conquer algorithm to implement string matching
- Next by thread: Re: divide & conquer algorithm to implement string matching
- Index(es):
Relevant Pages
|