Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 2 0 points ) You are given a set of rectangles S = { R 1 , R 2 , dots, R n }

(20 points) You are given a set of rectangles S={R1,R2,dots,Rn} such that all have their bottom sides on the x-axis. This means that each rectangle Ri is specified by a triple (li,ri,hi), where li and ri are the x coordinates of its left and right sides, and hi is the height. For simplicity, you may assume that all li,ri,hi for i=1,dots,n are distinct.
You will design an algorithm to compute the union C=R1R2cdotsRn. Clearly, the bottom side of C is a straight line segment from the leftmost lower-left corner u of R1,dots,Rn to the rightmost lower-right corner v of R1,dots,Rn. So you only need to find its upper boundary . Your algorithm should output as a list of "key points" sorted by their x coordinate in the form ((x1,y1),(x2,y2),dots). Each key point is the left endpoint of some horizontal segment in except the last point in the list, which always has a y-coordinate 0 and is used to mark the termination.
The following figure shows an example, where the input is
((2,9,10),(3,7,15),(5,12,12),(15,20,10),(19,24,8)),
and the output should be
((2,10),(3,15),(7,12),(12,0),(15,10),(20,8),(24,0)).
3
Design an algorithm that constructs in O(nlogn) time and analyze its running time. Your algorithm MUST use the following divide-andconquer strategy:
(i) Recursively solve the subproblems for R1,dots,Rn2 and Rn2+1,dots,Rn, respectively. Note that there is no particular ordering among R1,R2,dots,Rn in the input.
(ii) Let 1 and 2 be the outputs of the two recursive calls in (i).
(iii) Combine 1 and 2 to produce .
image text in transcribed

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

Explain the market segmentation.

Answered: 1 week ago

Question

Mention the bases on which consumer market can be segmented.

Answered: 1 week ago

Question

Explain consumer behaviour.

Answered: 1 week ago