Question: Please do each step You're walking along the beach and you st ub your toe on something in the sand. You dig around it and

 Please do each step You're walking along the beach and you

Please do each step

You're walking along the beach and you st ub your toe on something in the sand. You dig around it and find that it is a treasure chest of n golden bricks of different (integral) weight. Your backpack can only carry up to Wmax ounces before it breaks apart. You want to put as much in it as possible without going over, but you cannot break the golden bricks up. For the following problems, assume the arrays V=[v1,v2,,vn] and W=[w1,w2,,wn] describe the value and weight of each golden brick. That is, the i-th golden brick weighs wi ounces and is worth vi dollars. (a) (2 pts) One strategy is to keep picking golden bricks of the highest value, until reaching the limit of your backpack. Give an example of golden bricks for which this st rategy results in suboptimal solution. Make sure to list the weights and values of golden bricks, state the value in which the above strategy results, and state the optimal (larger) value that you could take away. (b) (8 pts) Prove that the problem of picking the golden bricks of maximum total value (given the contraints of your backpack) exhibits opt imal subst ructure. (c) (15 pts) Design a recursive backtracking (brute-force) algorithm that determines the maximum value of golden bricks that you can take away with you in your backpack. Write down the pseudocode. Don't worry about making it fast for this part. (d) (7 pts) Modify your pseudocode in part (c) to use memoization. Write down the modified pseudocode. (e) (13 pts) Design a polynomial-time bottom-up dynamic programming algorithm for finding the maximum value of golden bricks you can carry in you backpack. Write down the pseudocode and analyze the running time. Argue why your choice of the array and the order in which you fill in the values is the correct one

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!