Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE WRITE CODE IN HASKELL FOR FULL RATING Hercules has a job to do. He has to

ID: 3549237 • Letter: P

Question

PLEASE WRITE CODE IN HASKELL FOR FULL RATING

Hercules has a job to do. He has to slay the Hydra. The Hyrdra has nine heads. These are not just any heads; they are "level-9" heads. If one of them is cut off, eight level-8 heads grow to replace it. If you chop one of these, seven level-7 heads show up. This continues as you would imagine, until you get to a level-1 head. If you chop that one off, nothing else grows to take its place. The question is this: how many head-choppings does Hercules have to perform to kill the Hydra? There are closed-form solutions to this, but this is a lecture about recursion, so use recursion to solve this. Write a function that will take a representation of the Hydra and compute the number of choppings that has to happen to kill it. It's not required, but I do recommend you use tail recursion. You can also use a list to represent the Hydra.

Explanation / Answer

http://pastebin.com/tjA76e6T


go to this website it will help you very much

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote