Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 2 0 points ) You are given a set of rectangles S = { R 1 , R 2 , dots, R n }
points You are given a set of rectangles dots, such that all have their bottom sides on the axis. This means that each rectangle is specified by a triple where and are the coordinates of its left and right sides, and is the height. For simplicity, you may assume that all for dots, are distinct.
You will design an algorithm to compute the union cdots Clearly, the bottom side of is a straight line segment from the leftmost lowerleft corner of dots, to the rightmost lowerright corner of dots, So you only need to find its upper boundary Your algorithm should output as a list of "key points" sorted by their coordinate in the form dots Each key point is the left endpoint of some horizontal segment in except the last point in the list, which always has a ycoordinate and is used to mark the termination.
The following figure shows an example, where the input is
and the output should be
Design an algorithm that constructs in time and analyze its running time. Your algorithm MUST use the following divideandconquer strategy:
i Recursively solve the subproblems for dots, and dots, respectively. Note that there is no particular ordering among dots, in the input.
ii Let and be the outputs of the two recursive calls in i
iii Combine and to produce
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started