Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let x be a set of n intervals on the real line. A set of points P stabs x if every interval in x contains
Let be a set of intervals on the real line. A set of points stabs if every interval in
contains at least one points in Note that for each interval, both end points are considered
contained in the interval. Given the arrays dots, and dots, specifying the left and
right end points of the intervals, we want to design a greedy algorithm that computes the
smallest set of points stabbing Hint: review the interval scheduling problem and the greedy
stays ahead argument.
Figure : A set of intervals stabbed by points.
a Here is a possible greedy rule: find a point that stabs the maximum number of intervals,
remove the stabbed intervals and repeat. Show a counter example demonstrating that the
rule is not optimal or prove that the rule is optimal.
Solution:
b Here is a possible greedy rule: pick the smallest right end point among remaining inter
vals, remove the stabbed intervals and repeat. Show a counter example demonstrating
that the rule is not optimal or prove that the rule is optimal. Hint: use a greedy stays
ahead argument to show that the greedy choice is always greater than or equal to the
corresponding alternative choice.
Solution:
c Give pseudocode implementing your algorithm as fast as possible. Analyze the running
time. You can make calls to algorithms we learned in the course eg Karatsuba, mergesort,
etc.
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