Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Using the function CombineSkeletonsH H from Question your task is to design a DivideandConquer algorithm that computes the top skeleton of a set S of n horizontal line segments in the plane.
Each segment Si in S is represented as above as a triple li ri hi An example of the input instance is given in Fig. left and the top skeleton is highlighted in Fig. right
The output must follow the input format to CombineSkeletons stated in Question that is list the horizontal segments in the top skeleton from left to right. For example, Question points
The next two questions and will look at the top skeleton problem. The top
skeleton of a set of 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 We will study the special case where all the segments in are
horizontal segments with coordinates 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 is represented by the triple ri hi where li and ri denote
the left and right coordinates of the segment respectively, and hi denotes the
coordinate 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 prothe top skeleton shown Fig. right must be listed as:
a Description of how your algorithm works in plain English For full points
and assuming that CombineSkeletons runs in On time the algorithm should run
in On log time where n is the number of segments in S 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
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