I need help with this recursion question:
|show 4 more comments|
Don't code it! Instead compute the first 4 or so values by hand and see if you understand what is going on. You don't even have to look at the numbers, you just need to see what you are doing when you evaluate the code. E.g. try to say in words what you do when you follow the code. Pretend that you are explaining the program to a friend: "so this thing first checks whether the second parameter is less than 100..."
If you don't see what you are doing, then do some more iterations (by hand) and look at the numbers, you will easily recognise them. If you don't recognise them, please leave a comment here, telling us what the numbers are.
But let me repeat: if you want to practice reading code, try to understand what you are doing, rather than guess a pattern from the numbers. Therefore, do not code it!
|show 21 more comments|
HINT $\ \ $ Show the sequence of Current values has form $\rm\ 1,\ 1,\ 2,\ \cdots\ a,\ b,\ a+b$