-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exercises 1-5 for recursion tracing #27
base: master
Are you sure you want to change the base?
Conversation
- Recursive Case | ||
A problem that can be divided into smaller problems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... this is true. But not the definition of recursion. Recursion is specifically when a method calls itself, directly or indirectly.
- Tail Recursion | ||
|
||
the return value of any given recursive step is the same as the return value of the next recursive call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great answer! We didn't cover it in class though - so good googling :) I wonder though, does the answer make sense to you? I've been debating covering this in class - just not sure if there's time.
@@ -40,8 +61,16 @@ end | |||
``` | |||
|
|||
- What is mystery2(123)? | |||
mystery2(123) = (3) + mystery2(12) = 5 | |||
m2(12) = 1 + m2(1) = 2 | |||
m2(1) = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:) The logic is correct. but m2(12) should be 2 + m2(1) which changes the rest of the recursion math.
- _Added Fun: How could we make only alphabetic characters to be changed to stars?_ | ||
|
||
### Trace #6 | ||
### Trace #6 #Will come back to this one =) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or not... which is totally fine too :) 5/6 were just added challenges.
Recursion TracingLooks good |
Recursion Tracing
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions