Re: Need efficient search strategy in list of time intervals



On Tue, 31 Jul 2007 11:18:55 -0000, lemmi <dlemmermann@xxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :

Note: a standard binary search does not work because it might find a
time interval that ends before the input time span TS and then
interrupts its search even though another time interval is located
before it that ends after it.

Predigest your list so that you decide which band number you want for
any point on the line. You can create dummy bands to handle areas not
covered. Then you need do your binary search only on the start points
of each band. You look for a band start point <= to the search point.
Have a look inside com.mindprod.jdisplay.PrettyCanvas. It does this.
http://mindprod.com/products.html#JDISPLAY
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.