Maintaining data structure with two operations I was trying to implement data structure over set of rectangles that can perform two types of operations.


Update operation, add new rectangle with sides parallel to x and y axis and positive coordinates to the set.
Query operation, for some rectangle check if there is some rectangle intersecting with this rectangle.


I don't have big knowledge of data structures so I was thinking if you could give me some hints how to start approach this problem.

Thanks in advance.
You might want to look into R-trees (described in detail here) or a similar tree data structure for spatial indexing.