Question: Exercise 1 - 3 ( 1 5 Marks ) Given an integer target which represents the total distance to be covered by a robot on
Exercise
Marks
Given an integer target which represents the total distance to be covered by a robot on a straight road, and an array powerups of size N representing a number of power ups where power up is powerups i positions away from the start and gives powerupi amount of health units. The robot can take an infinite amount of power ups and starts with M health units. The task is to find the minimum number of times the robot has to collect power ups to reach target when it uses one unit of health for moving one unit distance. Note: If the robot reaches the power ups with health units left, it can collect the power up to increase his health.
Examples:a Write the recursive formulation of the optimal substructure of a Dynamic Programming algorithm to solve the above problem.b Can the above problem be solved optimally using a greedy algorithm? If yes, describe such algorithm using precise English statements. If not, explain why.
Answer the previous question with pen on paper showing your workout
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
