Question: The next two questions ( 2 . 1 and 2 . 2 ) will look at the top skeleton problem. The top skeleton of a
The next two questions and will look at the top skeleton problem. The top
skeleton of a set S of n line segments in the plane is an important concept for many
applications, including visibility and motion planning. The segments are regarded as
opaque obstacles, and their top skeleton consists of the portion of the segments visible
from the point infty We will study the special case where all the segments in S are
horizontal segments with ycoordinates greater than or equal to
An example of the input is given in Fig. left; the corresponding output is given in
Fig. right
A horizontal segment si in S is represented by the triple li ri hi where li and ri denote
the left and right xcoordinates of the segment respectively, and hi denotes the ycoordinate
of si The input is a list of triples; one per segment. The output is the top
skeleton specified as a list of horizontal segments arranged in order by their left
xcoordinates. For the example shown in Fig. the input and output are: We will solve the top skeleton problem using a divideandconquer approach.
Recall from the lecture that a divideandconquer algorithm works by recursively
breaking down a problem into smaller subproblems of the same type, until these become
simple enough to be solved directly. The solutions to the subproblems are then combined
into a solution to the original problem. Your task for Question is to handle the
combine step. That is as a subroutine to the divideandconquer algorithm Question
you will need CombineSkeletonsH H that takes two top skeletons as input and
produces a single top skeleton H of them. An example is shown in Fig. where two top
skeletons are given as input and combined into a single top skeleton.
You may assume that the two top skeletons passed as arguments to CombineSkeletons are
given as a list of horizontal segments ordered from left to right.
a Description of how your algorithm works in plain English For full points the
algorithm should run in On time where n is the total number of segments in H
and H points
b Argue why your algorithm is correct. points
c Prove an upper bound on the time complexity of your algorithm. points
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
