100% Guaranteed Results


CS270 – CSCI 270: Homework 6 Solved
$ 20.99
Category:

Description

5/5 – (1 vote)

1. From the lecture, you know how to use dynamic programming to solve the 0-1 knapsack problem where each item is unique and only one of each kind is available. Now let us consider the knapsack problem where you have infinitely many items of each kind. Namely, there are n different types of items. All the items of the same type i have equal size wi and value vi. You are offered with infinitely many items of each type. Design a dynamic programming algorithm to compute the optimal value you can get from a knapsack with capacity W.
a. Define (in plain English) subproblems to be solved. (4 pts)
b. Write a recurrence relation for the subproblems (6 pts)
c. Make sure you specify
a. base cases and their values (2 pts)
b. where the final answer can be found (1 pt)
d. What is the complexity of your solution? (2 pts)
2. Solve Kleinberg and Tardos, Chapter 6, Exercise 12.
a. Define (in plain English) subproblems to be solved. (4 pts)
b. Write a recurrence relation for the subproblems (6 pts)
c. Make sure you specify
i. base cases and their values (2 pts)
ii. where the final answer can be found (1 pt)
d. What is the complexity of your solution? (2 pts)
3. Givenrepresented by array nums. You are asked to burst all the balloons. If the you burstballoon๐‘› balloons, indexed fromyou will get 0 to ๐‘› โˆ’ 1. Each balloon is painted with a number on itcoins. Here and
time of your algorithm.
Here is an example. If you have the nums arrays equalssolution would be 167, where you burst balloons in the order of 1, 5, 3 and 8. The leftballoons after each step is: [3, 1, 5, 8]. The optimal
[3, 1, 5, 8] โ†’ [3, 5, 8] โ†’ [3, 8] โ†’ [8] โ†’ []
And the coins you get equals:
(3 โˆ— 1 โˆ— 5) + (3 โˆ— 5 โˆ— 8) + (1 โˆ— 3 โˆ— 8) + (1 โˆ— 8 โˆ— 1) = 167
a. Define (in plain English) subproblems to be solved. (4 pts)
b. Write a recurrence relation for the subproblems (6 pts)
c. Make sure you specify
i. base cases and their values (2 pts)
ii. where the final answer can be found (1 pt)
d. What is the complexity of your solution? (2 pts)
4. Suppose you have a rod of length N, and you want to cut up the rod and sell the pieces ๐‘๐‘– dollars. Devise a Dynamic Programming algorithm to determine the maximum amount๐‘– in a way that maximizes the total amount of money you get. A piece of length is worth
of money you can get by cutting the rod strategically and selling the cut pieces.
a. Define (in plain English) subproblems to be solved. (4 pts)
b. Write a recurrence relation for the subproblems (6 pts)
c. Using the recurrence formula in part b, write pseudocode to solve the problem. (5 pts)
d. Make sure you specify
i. base cases and their values (2 pts)
ii. where the final answer can be found (1 pt)
e. What is the complexity of your solution? (2 pts)
5. Solve Kleinberg and Tardos, Chapter 6, Exercise 10.
a. part(a) of the question (4pts)
b. part(b) of the question (answer according to the format below)
i. Define (in plain English) subproblems to be solved. (4 pts)
ii. Write a recurrence relation for the subproblems (6 pts)
iii. Using the recurrence formula in part ii, write pseudocode to solve the problem. (5 pts)
iv. Make sure you specify
i. base cases and their values (2 pts)
ii. where the final answer can be found (1 pt)
v. What is the complexity of your solution? (2 pts)

Reviews

There are no reviews yet.

Be the first to review “CS270 – CSCI 270: Homework 6 Solved”

Your email address will not be published. Required fields are marked *

Related products