CSE347T

Exam 2: Takehome

CSE347T代写 This exam is limited open book. You may use your course notes, textbook. And any materialon the course You may not talk…

  • This exam is limited open book. You may use your course notes, textbook. And any materialon the course You may not talk to your friends or classmates or use any resources on the internet.
  • Submit the solutions via Gradescope before 4 PM on Friday, April 16th. Late submissionswill not be accepted for any  You may typeset or handwrite your solutions. But try to make them clear, concise and readable.
  • Thereare 2 problems on this  Read each question carefully. Show your work, as partial credit may be given. You will be graded not only on the correctness of your answer. But also on the clarity with which you express it; so be neat. State all assumptions clearly. Do not waste time and paper rederiving facts that we have studied. It is sufficient to cite known results.
  • Provide the relevant details for the proofs while being as concise as possible. You will losepoints if you do skip steps or do not provide the appropriate arguments.
  • Do not provide multiple solutions to the same problem hoping that one of them is correct.We will only grade the first solution you provide.

Problem 1. CSE347T代写

[25 points] You are given a directed weighted graph G = (V, E) with a source s and a sink t. Each edge (u, v) has weight w(u, v). Your decision problem is “Is there an s-t cut of this graph with a total weight of exactly k?” In other words, can you split the vertices of the graph into two sets S and V S such that s S. And t V S and the total sum of the weights of the edges that go from a vertex u ∈ S to a vertex v ∈ V − S is exactly k.

Show that this problem is NP-complete.

Problem 2. CSE347T代写

[25 points] You are running a dorm library and you have a set of n books B ={b1, b2, …, bn} and m members X  =  {x1, x2, …, xm}.  For each member xi, you have Ri  ⊆ B, which is the set of books member xi wants to read. For simplicity, we can define Yj X as the set of members who want to read book bj. (Note that we can find these Yj’s given all the Ri’s since xi ∈ Yj iff bj ∈ Ri.) CSE347T代写

Each member is happy to read the books on their list in any order. Members may read different books at different speeds.  So you also have a function f (x, b) which tells you how much time it takes for member x to read book b.

A member can only borrow one book at a time and a particular book can only be lent to one member at a time. Once a member x borrows book b, they return it after exactly f (x, b) time.

CSE347T代写
CSE347T代写

Once they return the book, you can give them another unread book from their list immediately or at any time thereafter.

You want to create a schedule of lending books to members so that all members finish their books as quickly as possible. In particular, Fi is the time at which the member xi finishes reading all the books on their list. You want to minimize Fmax = maxxiX Fi.

Here is a candidate greedy approximation algorithm. Once a book is returned, immediately give it to any member who wants to read the book, hasn’t read it yet. And doesn’t have any other book checked out at this time. That is, a book never sits in the library if it can be legally checked out to anyone. We will prove that this algorithm provides a 2-approximation for minimizing Fmax.

  • [3points]  Say Si =     bj Ri  f (xi, bj). That is, Si is the total amount of time it will take for member xi to read all the books on their list if they could read them continuously one after the other. Say Smax = maxxiX Si. Argue that, for any algorithm for this problem, Fmax ≥ Smax. That is, Smax is a lower bound for this problem. CSE347T代写
  • [3points]  Say Qj =     xiYj  f (xi, bj). That is, Qj is the total amount of time book bj will be lent out to all the members Say Qmax = maxbj B Qj.  Argue that, for any algorithm for this problem, Fmax ≥ Qmax. That is, Qmax is also a lower bound for this problem.
  • [14 points]Now consider the greedy schedule. Say the last member to finish all the books on their list was xl (in the greedy schedule).  And the last book they read was book bk. Say xl checked out this book bk at time t. Argue that t ≤ Smax +Qmax −2f (xl, bk). Hint: Think about what prevented xl from getting this book bk before time t. CSE347T代写
  • [5 points]Argue that the greedy algorithm has an approximation ratio of at most 2. For this part, you may assume that all the previous parts are established, even if you were not able to prove them yourself.