1. Consider a greedy strategy for the following problem: We have a company with n workers. Worker wi works a shift (si,fi), where si is that worker’s start time and fi the finish time. We want to form a small committee C ⊆{w1,...,wn} with the following property: for every worker wi there exists a worker wc ∈ C such that the shift of wi overlaps with the shift of wc. That is, the intervals (si,fi) and (sc,fc) must intersect (they do not intersect if, say, fi = sc). So the problem is to find the smallest possible set C of workers whose shifts overlap with all workers.

(a) Describe the greedy choice. (“Choose the first worker with property P.”)
(b) Show that if there is an optimal solution for which the greedy choice was not made, then an exchange can be made to conform with your greedy choice. (“Let schedule S use worker wj who does not satisfy property P, and let wk be the worker that does. Here I show that the schedule S0, which is obtained by exchanging worker wj for wk, is just as good as S ...”)
(c) Describe, in English, how to implement a greedy algorithm.
(d) How long would your algorithm take?

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

The first worker in C would be the worker with the latest finish time which intersects with the worker who has the earliest finish time. So, first a worker should be selected with the earliest finish time from all workers. Then from the rest of the workers, we choose the one whos shift overlaps with the previously chosen and has the latest finish time. This worker is put into committee as first.

Let schedule S use the worker wj who does not satisfy the property of latest finish time, and let wk be the worker who does. Here I show that the schedule S´, which is obtained by exchanging wj and wk is just as good as S....
$10.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Data Structures and Algorithms Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats