Chapter 6: 2E (page 169)
You are going on a long trip. You start on the road at mile post . Along the way there are hotels, at mile posts , where each is measured from the starting point. The only places you are allowed to stop are at these hotels, but you can choose which of the hotels you stop at. You must stop at the final hotel (at distance ), which is your destination. You’d ideally like to travel miles a day, but this may not be possible (depending on the spacing of the hotels). If you travel x miles during a day, the penalty for that day is . You want to plan your trip so as to minimize the total penalty- that is, the sum, over all travel days, of the daily penalties.Give an efficient algorithm that determines the optimal sequence of hotels at which to stop
Short Answer
Dynamic programming provides an efficient algorithm to determine the optimal sequence of hotels.