Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Consider the activity selection problem as discussed in class where we are given n intervals (x1,y1),..., (n, yn) and we would like to

image text in transcribed

3. Consider the activity selection problem as discussed in class where we are given n intervals (x1,y1),..., (n, yn) and we would like to select a maximum number of pairwise disjoint intervals. Consider the following greedy algorithm for this problem: Algorithm 1 Activity Selection((1: Y1)...., (In, Yn)) A = {1,...,n} S+0 while A + 0 do Pick i A that minimizes |{j EA | (xi, yi) (xj, yj) 0}| breaking ties arbitrarily interval has smallest number of intersections i-th S+SU{i} A+ A- {i} AA end while return(S) {jA | (xi, yi)(xj, yj) 0} Removes i and all its intersecting intervals from A Prove or disprove that this greedy algorithm always outputs the optimal answer. To disprove you would need to provide a counter-example. To prove you need to prove that for all possible inputs it provides the optimal answer.

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Managerial Accounting

Authors: Stacey Whitecotton, Robert Libby, Fred Phillips

2nd edition

9780077493677, 78025516, 77493672, 9780077826482, 978-0078025518

More Books

Students also viewed these Accounting questions

Question

How are financial statements adjusted for exchange rates?

Answered: 1 week ago

Question

Elaborate on the wheel communication network.

Answered: 1 week ago

Question

Give an example of satisficing.

Answered: 1 week ago

Question

What are the five aspects of intuition?

Answered: 1 week ago