I have a problem on sequences of numbers:
Given a sequence of integer numbers (could be quite long, let say, 10s
of thousands of numbers). Let us denote it as
{n_1,n_2,n_3,n_4,...,n_L}. The length of the sequence is L (meaning
that it contains L numbers)
>From this sequence I want to find a segment of j consecutive numbers
S={n_i,n_(i+1),n_(i+2),...,n_(i+j)} such that the result of maximum
number of S minus the minimum number of S is smaller than user defined
d. The length of the segment j has to be larger than another user
defined f.
If there are more than one such segment, find them all.
I wonder whether there exists some linear algorithms to handle this
problem. The solution is better to be quick because it is only a
subproblem of the complete one and this operation is repeated several
times.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---