Skip to content

Conversation

@janicewilson
Copy link

Recursion Tracing

Thanks for doing some brain yoga. You are now submitting this assignment!

Comprehension Questions

Question Answer
Did you define all the recursion terms? Yes
How do you feel about tracing recursive problems? (good, bad, ugly, neutral) Good
Would you like help/follow up about recursion? I wouldn't mind a real-world application or two!

Recursion - A method calling itself.
Recursive Case - The case in which the "itself" is known.
Base Case - A case to ensure the recursive method can be exited. Recursive should always be heading toward base case.
Activation Chain/Stack The stored results of every call.
Activation Record/Call Each time the method references itself.
Infinite Recursion/Stack Overflow/Stack too deep - The method never exits as the base case isn't achievable.

Trace #1a - 15
Trace #1b - 55
Trace #1c - Infinite Recursion

Trace #2a - 8
Trace #2b - 14
Trace #2c - (123)

Trace #3a - 100
Trace #3b - 100
Trace #3c - 200

Trace #4a - 100
Trace #4b - 64
Trace #4c - 5

Trace #5a - *i
Trace #5b - “”
Trace #5c - *i, there!

@sudocrystal
Copy link

Recursion Tracing

It's a little hard to respond to your answers when they are answered in the PR instead of in a file because I can't comment inline. But I can make it work :)

Definition of "recursive case" does not make sense to me.

Definition of "Activation Chain/Stack" is confusing to me as well. It doesn't store results. It tracks the method calls themselves.

Definition of "Activation Record/Call" is each individual call to the recursive method. I think the wording "references itself" throws me here.

Traces 1-4 look good.

You should revisit trace 5, it is not correct.

@janicewilson
Copy link
Author

janicewilson commented Apr 13, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants