title: Data structure for handling intervals
body: <p>I have got a series of time intervals (t_start,t_end), that cannot overlap, i.e.: t_end(i) > t_start(i+1). I want to do the following operations:</p>
  
  <p>1) Add new (Union of) intervals [ {(1,4),(8,10)} U (3,7) = {(1,7),(8,10)} ]<br>
  2) Take intervals out [ (1,7) - (3,5) = {(1,3),(5,7)}<br>
  3) Checking whether a point or a interval overlaps with an interval in my series (intersection)<br>
  4) Finding the first "non-interval" of a minimum length after some point [ {(1,4),(7,8)}: there is a "non-interval" of length 3 between 4 and 7 ].</p>
  
  <p>I want to know good ways of implementing this, with low complexities (log n for all operations would do it).</p>
  
  <p>Related question: <a href="https://stackoverflow.com/questions/1580185/data-structure-for-quick-time-interval-look-up">Data structure for quick time interval look up</a></p>