Question: Let D be a dynamic data structure that stores n 2-dimensional points and supports in O(log n) time queries of the type func(x, y) that

Let D be a dynamic data structure that stores n 2-dimensional points and supports in O(log n) time queries of the type func(x, y) that returns the number of points that are to the left of the vertical line through x and below the horizontal line through y (for such a query we assume that neither x nor y is the coordinate of a point stored in D). Explain how you would get D to also support in O(log n) time queries of the type Rectangle(x1, x2, y1, y2), where x1 < x2 and y1 < y2, that returns the number of points stored in D that are inside the rectangle whose 4 corners are (x1, y1), (x2, y2), (x1, y2), (x2, y1); for such a query we assume that none of {x1, x2, y1, y2} is coordinate of a point in D. Hint. Implement the new query type using the old query type already supported by D.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!