Question: The answer to first part was 10. But I'm having trouble on second part. Please provide detailed answer. Thanks Part IV: Recursive Algorithms (20 pt.)

 The answer to first part was 10. But I'm having trouble

The answer to first part was 10. But I'm having trouble on second part. Please provide detailed answer. Thanks

Part IV: Recursive Algorithms (20 pt.) Given the following recursive algorithm: procedure foo(x, y) Input: x: positive integer, y: integer Output:??? if x=-1 then return y else return foo(x-1, y) y 1. (4 pt., 2 pt. each) Trace algorithm foo for each of the following inputs: x=2 and y=5. x=3 and y-2. That is, show all steps performed by the algorithm for these inputs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!