in reply to Can I speed this up? (repetitively scanning ranges in a large array)
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can I speed this up?
by daverave (Scribe) on Nov 01, 2010 at 18:14 UTC |