Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 4 (25 points) Suppose you are given a set T-{(s1, ' . . . , (sn, f.)} of n tasks. where each task i

image text in transcribed

Problem 4 (25 points) Suppose you are given a set T-{(s1, ' . . . , (sn, f.)} of n tasks. where each task i is defined by the start time s and a finish time fi. Two tasks t, and t, are non-conflicting if fi Sj or f,5-The activity selection problem asks for the largest nuxnber of task can be schod a non conilicting way. T'he y alorit. explained in class considers tasks one by one ordered by the finish time. Ordering by increasing finish time is crucial to prove that this strategy always leads to the optimal solution. Does the following greedy algorithm compute the optimal solution for activity selection? 1. Compute the number of overlaps for each task 2. Sort the task by the number of overlaps, in increasing order (break ties arbitrarily) 3. Pick the task i with the smallest number of overlaps, schedule it, and remove from further consideration tasks that are overlapping with i 4. Repeat step 3 until all tasks are scheduled Note that the number of overlaps is NOT updated after step 1. If you think the strategy works, prove that the greedy choice property hold. If not, show an example where this strategy gives a suboptimal solution. Problem 4 (25 points) Suppose you are given a set T-{(s1, ' . . . , (sn, f.)} of n tasks. where each task i is defined by the start time s and a finish time fi. Two tasks t, and t, are non-conflicting if fi Sj or f,5-The activity selection problem asks for the largest nuxnber of task can be schod a non conilicting way. T'he y alorit. explained in class considers tasks one by one ordered by the finish time. Ordering by increasing finish time is crucial to prove that this strategy always leads to the optimal solution. Does the following greedy algorithm compute the optimal solution for activity selection? 1. Compute the number of overlaps for each task 2. Sort the task by the number of overlaps, in increasing order (break ties arbitrarily) 3. Pick the task i with the smallest number of overlaps, schedule it, and remove from further consideration tasks that are overlapping with i 4. Repeat step 3 until all tasks are scheduled Note that the number of overlaps is NOT updated after step 1. If you think the strategy works, prove that the greedy choice property hold. If not, show an example where this strategy gives a suboptimal solution

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

What is privatization?

Answered: 1 week ago

Question

=+13.4. 1 Relate the result in Problem 13.3 to Theorem 5.1(ii).

Answered: 1 week ago