Question: ( 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
