title: Subtract Overlaps Between Two Ranges Without Sets
body: <p><strong>NO SETS!</strong></p>
  <p>I can't use Sets because:</p>
  <ul>
  <li>The ranges will be too long.</li>
  <li>They will take up too much memory</li>
  <li>The creation of the sets themselves will take too long.</li>
  </ul>
  <hr />
  <p>Using only the endpoints of the of the ranges, is there an optimal way to subtract two lists of ranges?</p>
  <h3>Example:</h3>
  <pre><code>r1 = (1, 1000), (1100, 1200)  
  r2 = (30, 50), (60, 200), (1150, 1300)
  
  r1 - r2 = (1, 29), (51, 59), (201, 1000), (1100, 1149)
  </code></pre>
  <h3>Other info:</h3>
  <ul>
  <li>r2 does not have to overlap r1</li>
  <li>r1 and r2 will not have pairs that overlap other pairs.  For instance, r1 will not have both (0,30) and (10, 25)</li>
  </ul>
  <p>Thanks.</p>