Answer to Question #305208 in Algorithms for Abhik

Question #305208

Mr. Monkey is in a garden, and stands in front of a row of banana trees. Let the trees be numbered as t1, t2, · · · tn as usual. He will start walking from some point, say s which is to the left of the leftmost tree. From this point, assume that he moves only to his right. Once he reaches a tree, he has two choices - either to walk past it or climb it and eat exactly one banana. Eating a banana make him jump a some distance over a few trees. In case he lands on the ground, he can continue the above exercise from that point. In case the first jump lands him on a tree, he can either climb down and continue the exercise or he can eat the bananas from there and continue jumping.

Let dist be an array that contains the distance of ti from the starting point s and jump be an array that contains the distance that Mr. Monkey can jump if he eats a banana from ti


Write an O(n*2) algorithm that determines the maximum distance that Mr. Monkey can jump. Note that this does not include the distance he walks or climbs.


0
Service report
It's been a while since this question is posted here. Still, the answer hasn't been got. Consider converting this question to a fully qualified assignment, and we will try to assist. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS