The potential maxima are at the center of your ranges. Since the peaks are all the same size (ranges being all 5k wide, and the same slope (+/-1 per unit distance) then the minima will be at the half way point between two maxima.
4k |- / \ / \ / \ / \ / 2k |- / \/ \ / \ / 0k |- / \/ \___/
Since you know where the peaks are (start+2.5k), and you can sort the ranges by start position, you can trivially identify the neighboring ranges. Halfway between the peak of range N and range N+1, there might be a local minima, or a flat spot, as in the picture.
The value at the minima will be easily calculated once located by finding the distance to either of the two ranges causing it.
In reply to Re^6: Finding Local Minima
by SuicideJunkie
in thread Can I speed this up? (repetitively scanning ranges in a large array)
by daverave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |