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 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....

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Letter Dice Problem in C++
Homework Solution
Computer Science
Letter Dice
Edmonds-Karp Algorithm
Maximum Flow
Augmenting Paths
Get help from a qualified tutor
Live Chats