What I currently do is to initialize a results array of size max_length (i.e. 4M) to zeros.Then, for each range (start, end) I iterate over all coordinates i in (start,end).
I take min(i-start,end-i) (i.e. the distance to the nearest end of the range) and update results(i) with it if this val is larger.
I can't reproduce your results for your 3-ranges max-10 example by following those steps? I get 0 1 1 2 2 1 0 0 0 0.
So I think you really will have to post code.
In reply to Re: Can I speed this up?
by BrowserUk
in thread Can I speed this up? (repetitively scanning ranges in a large array)
by daverave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |