Home / Expert Answers / Computer Science / warm-up-problem-0a-karel-goes-home-as-most-of-you-know-karel-the-robot-lives-in-a-world-composed-pa886

(Solved): Warm-up problem 0a Karel Goes Home As most of you know, Karel the Robot lives in a world composed ...



Warm-up problem 0a Karel Goes Home
As most of you know, Karel the Robot lives in a world composed of streets and avenues
laid

Warm-up problem 0a Karel Goes Home As most of you know, Karel the Robot lives in a world composed of streets and avenues laid out in a regular rectangular grid that looks like this: 6 5 Streets 2 . 9, . 1 . 1 2 5 6 3 4 Avenues 1/8 Suppose that Karel is sitting on the intersection of 2nd Street and 3rd Avenue as shown in the diagram and wants to get back to the origin at 1st Street and 1st Avenue. Even if Karel wants to avoid going out of the way, there are still several equally short paths. For example, in this diagram there are three possible routes, as follows: Your job in this problem is to write a recursive function int CountPaths (int street, int avenue) that returns the number of paths Karel could take back to the origin from the specified starting position, subject to the condition that Karel doesn't want to take any unnecessary steps and can therefore only move west or south (left or down in the diagram).


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe