Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please finish question c Mary Startupperberg is travelling to meet an important investor. The investor is available all day, so Mary can choose any time
please finish question c
Mary Startupperberg is travelling to meet an important investor. The investor is available all day, so Mary can choose any time to meet. The train takes 2 hours and the earliest Mary could return would be 2 hours after she arrives, althouglh she can stay longer if it is cheaper to return later. The train fares are contained in the arrays Out and Rtn, both of length N, such that Outli] and Rtnlil are the fares for the ith outbound and return trains respectively, which both depart at the same time. There is one train per hour in both directions, so the first possibility is to take the first outbound train and the fifth return train. Mary wants to find the lowest total fare she can pay. c Explain how to decompose this problem into N subproblems. Your answer should say what the subproblems are (what a solution to a subproblem means), how they can be solved, and how they combine to give the overall solution. i) Can the problem be solved using dynamic programming? Explain your answer with reference to your decomposition of the problem. ii) ii) Write a procedure that solves the problem. Your procedure should iterate through the input data at most once The three parts carry, respectively, 30%, 25%, and 45% of the marks. Mary Startupperberg is travelling to meet an important investor. The investor is available all day, so Mary can choose any time to meet. The train takes 2 hours and the earliest Mary could return would be 2 hours after she arrives, althouglh she can stay longer if it is cheaper to return later. The train fares are contained in the arrays Out and Rtn, both of length N, such that Outli] and Rtnlil are the fares for the ith outbound and return trains respectively, which both depart at the same time. There is one train per hour in both directions, so the first possibility is to take the first outbound train and the fifth return train. Mary wants to find the lowest total fare she can pay. c Explain how to decompose this problem into N subproblems. Your answer should say what the subproblems are (what a solution to a subproblem means), how they can be solved, and how they combine to give the overall solution. i) Can the problem be solved using dynamic programming? Explain your answer with reference to your decomposition of the problem. ii) ii) Write a procedure that solves the problem. Your procedure should iterate through the input data at most once The three parts carry, respectively, 30%, 25%, and 45% of the marksStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started