Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Dynamic Programming question thanks! 3. (10 pts) Assume you are planning a canoe trip down a river. The river has n trading posts numbered 1

Dynamic Programming question thanks!

image text in transcribedimage text in transcribed

3. (10 pts) Assume you are planning a canoe trip down a river. The river has n trading posts numbered 1 to n going downstream. You will start your trip at trading post number 1 and end at trading post number n. Let R(i,j) be the cost of renting a canoe at trading post i and returning it at trading post j, where j i. Assume that you always want to go down river, so the costs ifj i are irrelevant. Find the cheapest sequence of rentals that allow you to complete your trip. Aim for an algorithm running in O(n2) time. For example, if n - 4 and the costs are: R(ij) 15 25 35 12 16 2 then the cheapest sequence of canoe rentals to travel the river would be to rent from 1 to 3, and then from 3 to 4 for a cost of 25 +5-30. On the other hand, if the costs were: 20 15 30 5 10 20 2 then taking one canoe all the way from 1 to 4 and renting 1 to 2 and then 2 to 4 are the cheapest solutions (both cost 30). (Note that renting from 1 to 3 is cheaper than going 1 to 2, but the 1 to 3 rental is not in any of the cheapest 1 to 4 solutions.) Let C(k) be the cost of the cheapest sequence of canoe rentals starting from trading post 1 and returning the last canoe rented at trading post k. (a) (3 pts) Assume an optimal sequence of rentals changes canoes at some trading post j. What subproblems are also solved optimally by (parts of) this rental sequence? Prove your answer (probably using a proof by contradiction) (b) (2 pts) Derive a recurrence for C(k) in terms of C(j) values where j

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

ISBN: 0805302441, 978-0805302448

More Books

Students also viewed these Databases questions