Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Let R be a set of n rectangles, R i = [l i , r i ] [b i , t i ], in the

Let R be a set of n rectangles, Ri = [li, ri] ×[bi, ti], in the plane, with sides parallel to the coordinate axes. Let P be a set of n points, pj = (xj , yj ), in the plane. For simplicity, assume that all x-coordinates and all y-coordinates in R∪P are distinct. Given R and P, our goal is to decide for every point in P whether or not that point lies inside at least one rectangle of R, i.e., the output should simply be “IN” if the point lies inside at least one rectangle of R, and “OUT” otherwise. (An example of this is when trying to classify the location of different mouse clicks on a computer screen that has multiple open windows.) We would like to design an O(n log n)-time sweepline algorithm for this problem which uses an interval tree as a supporting data structure. (Do not modify the tree; use it as a black-box and make calls to the relevant routines.)

DO: (a) Provide a discussion of the main ideas underlying your solution, from which the correctness of your approach is clear.
(b) Give pseudocode.
(c) Analyze the running time.

Step by Step Solution

3.51 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

My solution involves constructing a support interval tree which allows us to quickly determine wheth... 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_2

Step: 3

blur-text-image_3

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

Cost Accounting A Managerial Emphasis

Authors: Charles T. Horngren, Srikant M.Dater, George Foster, Madhav

13th Edition

8120335643, 136126634, 978-0136126638

More Books

Students also viewed these Accounting questions

Question

When is a company justified in inventorying scrap?

Answered: 1 week ago