Answered step by step
Verified Expert Solution
Link Copied!
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 x be a set of n intervals on the real line. A set of points P stabs x if every interval in x
contains at least one points in P. Note that for each interval, both end points are considered
contained in the interval. Given the arrays xL[1,dots,n] and xR[1,dots,n] 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 x. Hint: review the interval scheduling problem and the greedy
stays ahead argument.
Figure 1: A set of intervals stabbed by 3 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 e.g. Karatsuba, mergesort,
etc.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students explore these related Databases questions

Question

microservices warm - up

Answered: 3 weeks ago

Question

15-5 How will MIS help my career?

Answered: 3 weeks ago