title: Efficient data structure for finding non-overlapping range containing a number
body: <p>a data structure to store the start and endpoint of a range.</p>
  
  <pre><code>rangename      start     end
  
  range1          10        11
  
  range2          20        22
  
  range3          0         5
  </code></pre>
  
  <p>now if i have to find the range in which a number 'x' may exist.</p>
  
  <p>What would be the efficient way of storing this in c++ ?</p>
  
  <p>I'm trying to use map. but then search to find the range might be expensive ( which i'm not sure of). Suggest a good data structure.</p>
  
  <p><em>I should be able to find whether the element is present in a range or not. The ranges should not be mix and matched and no adjacent or other bounds.</em></p>
  
  <p>If I need to a find an element 3, it is present in range 3, But an element 12 is not present at all. Just looping through cannot be an efficient way.</p>