# hw8 - for the fractional knapsack problem based on a greedy...

This preview shows page 1. Sign up to view the full content.

CSE 413, Analysis of Algorithms Fall Semester, 2004 Assignment 8: Transformation and NP-hardness Due Date : Dec. 8, 2004 (at the beginning of CSE 413 class) 1. Consider the following fractional knapsack problem : Given a knapsack of size K and n items of sizes k 1 , k 2 , ..., k n , respectively, such that the i -th item is worth a value of v i (the numbers K , k i ’s, and v i ’s need not be integers), use these items to pack the knapsack, such that the total sum of values of the items packed in the knapsack is as large as possible and the total sum of sizes of the items packed in the knapsack is no bigger than K . However, when packing an item, you may put any fractional amount of that item into the knapsack (i.e., you may imagine that each item is a pile of powder of a certain type, which you may take any amount out of its total size). Note that this is diFerent from the knapsack problem (called 0-1 knapsack ) discussed in class in which an item is either taken as a whole into the knapsack or not taken at all. Design an eﬃcient algorithm
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for the fractional knapsack problem based on a greedy method. ( 20 points ) 2. Problem 10.19, page 339. ( 20 points ) 3. Problem 5.20, page 116. Also, prove that the partition problem is in the class of NP. ( 25 points ) 4. Consider the following constrained-length path problem : Given a positive integer L , a directed graph G = ( V, E ) such that every edge of G has a non-negative integer weight, and two vertices s and t in G , determine whether there is a simple directed s-to-t path in G whose length (i.e., the total sum of weights of edges on the path) is exactly L . You are asked to do the following: (1) Prove that the constrained-length path problem is in the class of NP. ( 10 points ) (2) Prove that the constrained-length path problem is NP-complete. (Hint: You may assume that the 0-1 knapsack problem is known to be NP-complete and transform the 0-1 knapsack problem to this problem deterministically in polynomial time.) ( 15 points ) Total Points : 90...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online