6. Houston, we have a problem! Alina and Kaitlyn decide to make the drive from Ann...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
6. Houston, we have a problem! Alina and Kaitlyn decide to make the drive from Ann Arbor to Houston to cheer on the Wolverines at the College Football National Championship Game! They start their drive from Ann Arbor and make their way to Houston. Along their journey, there are n hotels, located at positive distances a < a2 < < an from Ann Arbor. They can stop only at these specified hotels, but may choose which one(s) to spend their night(s) at, and which ones to skip. They must end their journey at the last hotel, located at distance an. The trip from Ann Arbor to Houston is 1300 miles. They don't want to drive too much or too little in a day, so they are aiming to go about 500 miles per day. However, due to the distance between the hotels, this may not always be possible. If they drive miles on a given day, they will face a "penalty" of (500 - x) for that day. For example, if a 450, a2 = 670, a3 = 1300, then we have the following possible choices of hotels (by their indices) and the associated penalties: 1, 2, 3 (500 450) + (500 220) + (500 630) 2,3 (500 - 670) + (500 - 630) 1,3 (500 450) + (500 - 850) (500 - 1300) 3 97800 = 45800 = 125000 = 640000 = Therefore, the minimum possible total penalty is 45,800. Alina and Kaitlyn should drive to the second hotel (at 670 miles) on the first day, then drive the remaining 630 miles to Houston on the second day. The goal in this problem is to devise an efficient algorithm that, given an array A[1...n] of the distances a,..., an, determines which hotel(s) to stop at so as to minimize the total penalty incurred on the trip. Hint: Consider a function p(j) that represents the minimum possible total penalty when start- ing from Ann Arbor and ending at hotel j. Solution: (a) Give, with justification, a recurrence relation for p(j) that is suitable for a dynamic- programming solution to the problem. Be sure to identify the base case(s). (b) Give pseudocode for a (bottom-up) dynamic programming algorithm that solves the prob- lem, and analyze its running time. 6. Houston, we have a problem! Alina and Kaitlyn decide to make the drive from Ann Arbor to Houston to cheer on the Wolverines at the College Football National Championship Game! They start their drive from Ann Arbor and make their way to Houston. Along their journey, there are n hotels, located at positive distances a < a2 < < an from Ann Arbor. They can stop only at these specified hotels, but may choose which one(s) to spend their night(s) at, and which ones to skip. They must end their journey at the last hotel, located at distance an. The trip from Ann Arbor to Houston is 1300 miles. They don't want to drive too much or too little in a day, so they are aiming to go about 500 miles per day. However, due to the distance between the hotels, this may not always be possible. If they drive miles on a given day, they will face a "penalty" of (500 - x) for that day. For example, if a 450, a2 = 670, a3 = 1300, then we have the following possible choices of hotels (by their indices) and the associated penalties: 1, 2, 3 (500 450) + (500 220) + (500 630) 2,3 (500 - 670) + (500 - 630) 1,3 (500 450) + (500 - 850) (500 - 1300) 3 97800 = 45800 = 125000 = 640000 = Therefore, the minimum possible total penalty is 45,800. Alina and Kaitlyn should drive to the second hotel (at 670 miles) on the first day, then drive the remaining 630 miles to Houston on the second day. The goal in this problem is to devise an efficient algorithm that, given an array A[1...n] of the distances a,..., an, determines which hotel(s) to stop at so as to minimize the total penalty incurred on the trip. Hint: Consider a function p(j) that represents the minimum possible total penalty when start- ing from Ann Arbor and ending at hotel j. Solution: (a) Give, with justification, a recurrence relation for p(j) that is suitable for a dynamic- programming solution to the problem. Be sure to identify the base case(s). (b) Give pseudocode for a (bottom-up) dynamic programming algorithm that solves the prob- lem, and analyze its running time.
Expert Answer:
Related Book For
Statistics The Art And Science Of Learning From Data
ISBN: 9780321755940
3rd Edition
Authors: Alan Agresti, Christine A. Franklin
Posted Date:
Students also viewed these algorithms questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
CPA firm brings in a yoga instructor during the tax busy season to help relieve stress of the employees. Which is true about the CPA firm's ability to take a deduction for the yoga instructor's...
-
Charity Bell bought a used Toyota Avalon from Awny Gobran of Gobran Auto Sales, Inc. The odometer showed that the car had been driven 147,000 miles. Bell asked whether it had been in any accidents....
-
Sugar Land Creamery is planning to launch a new flavor of ice cream and wants to get a "snapshot" of the potential market. The ice cream has a coconut-white chocolate flavor with mixed-in pistachios...
-
What is the internal rate of return of the following cash flow diagram? a. 20 percent b. 18.2 percent c. 17.5 percent d. 15 percent $30 $31 0 1 2 3 $30 $15
-
(Warrants Issued with Bonds and Convertible Bonds) Incurring long-term debt with an arrangement whereby lenders receive an option to buy common stock during all or a portion of the time the debt is...
-
2. Prove that for any integer n 1, and any set of n real numbers {x1,. . . Xn} |x1 + . . . + xn| |x1|+ . . . + |xn|. Can you identify exactly in which cases equality hold for n = 2 (i.e., the...
-
Determine the amount of the Earned Income Credit in each of the following cases. Assume that the person or persons is/are eligible to take the credit. Calculate the credit using the formulas. (For...
-
Adam is a student at the School of Fine Art. To help pay his tuition, he took a job in the school's student records department. The work is to develop program that calculates each student's grade...
-
Technological progress results in firms experiencing an ongoing state of change. Using a change model of your choice , describe how you would advise M&Co to manage the ongoing changes associated with...
-
A car (mass = 1160 kg) is traveling at 29.0 m/s when it collides head-on with a sport utility vehicle (mass = 2460 kg) traveling in the opposite direction. In the collision, the two vehicles come to...
-
Assume that you have been asked to estimate the PE ratio for a firm which has the following characteristics: High Growth Phase Stable Growth Phase Length of Period 5 years Forever after year 5 Return...
-
using recursion and recursive data structures. No loops please. Please help with return statements for isValid() and is ValidAdvanced() public class Block { public int id; // Number public int rank;...
-
Max's decision to invest in the group of assets he located has allowed him to change the focus of his work slightly. Max will now have extra time to focus on improving the success of his DIY Clean...
-
Assume today is the 21st of February. Using the information below, FT Extract, answer the following questions (parts i and ii). You work for a US company that is due to receive 250 million in June...
-
The table shows a short excerpt from the Car Weight and Mileage data file on the text CD. That file lists several 2004 model cars with automatic transmission and their x = weight (in pounds) and y =...
-
A local telephone directory has 50,000 names, 100 per page for 500 pages. Explaining how you found and used random numbers, select 10 numbers to identify subjects for a simple random sample of 10...
-
Refer to the High School Female Athlete and Male Athlete Strength data files on the text CD. a. Find the correlation between number of 60-pound bench presses before fatigue and bench press maximum...
-
What accounts for the disparity in NPMO between the statistical 6 and the popular Six Sigma approach?
-
What is the most common use of stratification?
-
What purpose is served by flowcharts?
Study smarter with the SolutionInn App