Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions