subject

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 if j ≤ i are irrelevant. Find the cheapest sequence of rentals that allow you to complete your trip. Aim for an algorithm running in O(n 2 ) 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. 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? B. Derive a recurrence for C(k) in terms of C(j) values where j < k. C. Give a bottom-up iterative algorithm for computing the C(j) values. D. Finally, show how keeping a little (i. e. O(n)) additional information allows the a cheapest sequence of canoe rentals to be printed out in O(n) time. For part (c), it may be helpful to first construct a recursive algorithm for computing the C(k) values.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:30
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
question
Computers and Technology, 22.06.2019 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
You know the right answer?
Assume you are planning a canoe trip down a river. The river has n trading posts numbered 1 to n goi...
Questions
question
Mathematics, 30.04.2021 21:10
question
Mathematics, 30.04.2021 21:10
question
Mathematics, 30.04.2021 21:10
question
Mathematics, 30.04.2021 21:10
Questions on the website: 13722360