title: Find rectangles that contain point – Efficient Algorithm
body: <p>Good afternoon.</p>
  
  <p><strong>My situation:</strong></p>
  
  <ul>
  <li>In <em>two-dimensional space</em>.</li>
  <li><strong>Input</strong>: a set of <em>rectangles</em> (<em>overlapping rectangles</em> too).
  
  <ul>
  <li>Rectangles coordinates are <em>integer type</em>.</li>
  <li>There are not any constraints on rectangle-size and rectangle-location (only extent of integer).  </li>
  <li>No rectangles have width=0 or height=0.</li>
  </ul></li>
  <li><strong>I need to find</strong>: all rectangles that contain entered <em>point</em> (with <em>integer</em> coordinates).</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/pYdHl.png" alt="Find rectangles that contain entered point."></p>
  
  <p><strong>Questions:</strong></p>
  
  <ul>
  <li>What is the efficient structure to keep rectangles?</li>
  <li>What alghorithm is efficient in this case?
  
  <ul>
  <li>And what algorithm is efficient only for adding rectangles without removing?</li>
  </ul></li>
  </ul>
  
  <p>Thanks :-).</p>