Seeking wisdom: I have a set of number sequences, given a length parameter n, and minimum occurance parameter m, I'd like to find common continuous subsequences of length n that occur at least m times. Here's an example:
@a = ( [2,5,10,5,12,6,21,5,10,12,23],
$m = 2;
$n = 2;
I'd like the result to be the set containing the following sequences (hopefully I haven't missed any):
(5,10) #which occured twice in 1st, once in 2nd and 3rd
(10,5) # which occured once in 1st and 2nd
(6,21,5) # which occured once in 1st and 2nd
performance is a concern since both the length and the number of sequences can be pretty big, say 1000. Thanks.
Update: I meant "at least length n". The subsequence does need to be in different sequences, but I'd like to have
a total count including multiple occurances within the same sequence.