in reply to Help the counting!
What is bp?
Without exactly knowing what you want I can tell you that your script seems to have 3 loops nested into each other which will make the running time of your script unbearable for non-trivial data. And your problem doesn't seem to need that.
How about this algorithm: Sort the ranges in ascending start position (you need to use a more complex data structure like Array-of-Arrays for this). Store the range of the first cluster into $xstart and $xend. For each new cluster (outer loop) test if the new cluster overlaps and if yes, count the overlap (inner loop) and update $xend with the end of the range
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Help the counting!
by g-alone (Initiate) on Mar 22, 2012 at 12:39 UTC | |
by jethro (Monsignor) on Mar 22, 2012 at 13:48 UTC |
In Section
Seekers of Perl Wisdom