Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider a computer game with a 2 D map with axes A ( A _ ( 1 ) , A _ ( 2 ) ,
Consider a computer game with a D map with axes AAAdots,An and BBBdots,Bm The
goal is to start from AB and arrive at AnBm by moving one step at a time. At each coordinate
you arrive, you gain a positive number of game points. You have to reach C coins at the end
of the game your total score should be C not less or not more Additionally, there is a rule
that constricts your movement. If you are at AiBj your next move should be either AiBj or
AiBj no other.
Example of the game map and proper gameplay: Gameplay example :
Route: ABABABABdotsAnBm
Points: dotsC
Gameplay example :
Route: ABABABABdotsAnBm
Points: dotsC
Problem: To find the number of possible routes to reach exactly points at the end of the game
a Construct an algorithm which is not a DP algorithm to solve the problem and write down the pseudocode.
b Analyze the time complexity of your algorithm.
c Without using DP how does affects the running time of the algorithm?
d Design a DP algorithm to solve the problem.
e Is it necessary to use DP if the problem asks for the maximum number of points, instead of exactly points?
when you are asked to design a dynamic programming algorithm, you should answer the following questions.
i What are the sequence decision steps?
ii What are the alternatives at each decision step?
iii Describe the subproblems.
iv Write the recurrence relation. Explain why it is correct.
v Describe the table that is necessary for the dynamic programming algorithm.
vi Describe how to fill the table.
vii Write down the pseudocode of the dynamic programming algorithm to fill the table.
viii Analyze the running time efficiency of your algorithm.
ix Analyze the space efficiency.
x Write down the pseudocode of an algorithm to find the actual solution for the problem
Step 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