There's more than one way to do things | |
PerlMonks |
Re: Seeking algorithm for finding common continous sub-patternsby tachyon (Chancellor) |
on Dec 03, 2004 at 09:33 UTC ( [id://412073]=note: print w/replies, xml ) | Need Help?? |
Maybe this will be fast enough for you. Maybe you need to be a bit more specific with your spec. This will not scale very well. The 27 element data set consumes 120 loops in the generation phase and 34 in the output phase for a total of 154. It is roughly O(n^2) but it is quite data dependent. I wrote Algorithm::LCSS which is based on Algorithm::Diff and may be a better option depending on the real task. The problem with that approach is that it is a one to one comparison not many to many which is what you seem to want.
cheers tachyon
In Section
Seekers of Perl Wisdom
|
|