next up previous
Next: Up: Previous:

Interval Trees

Used for scheduling and planning.



Problem: Need data structure that determines if any of a stored set of intervals overlaps a given interval. We want to perform all associated operations in O(lg n) time.

Define a closed interval object i as [t1, t2] such that \(t_1 \leq t_2\), low(i) =t1, and high(i) = t2.



Overlap(i1, i2)
1
$\;\;\;\;\;$if low(i1) $\leq$ high(i2) and low(i2) $\leq$ high(i1)
2
$\;\;\;\;\;$then return True
3
$\;\;\;\;\;$else return False

Does [2, 7] overlap [5, 8]? Yes. 2 is less than 8, and 5 is less than 7, points 6, 7 common to both.


next up previous
Next: Up: Previous: