Skip to content

Queues - Cara Comfort - recursion-tracing #21

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions recursion-tracing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Trace #1
* mystery1(5) = 15
* mystery1(10) = 55
* mystery1(0) = stack too deep/infinite recursion

## Trace #2
=> summation of digits
* mystery2(123) = 6
* mystery2(9005) = 14
* mystery2(-123) = -123

## Trace #3
=> 100 if n >= 0, 200 if n < 0
* mystery3(1) = 100
* mystery3(13) = 100
* mystery3(-6) = 200

## Trace #4
=> b^e
* mystery4(10,2) = 100
* mystery4(4,3) = 64
* mystery4(5,0) = 1

## Trace #5
=> number of stars equal to the string length
* mystery5("hi") = "**"
* mystery5("") = ""
* mystery5("Hi, there!") = "**********"

## Trace #6
=> reverses the words with a space in front of each word
* mystery6("goodnight moon") = " moon goodnight"
* mystery6("Ada Developers Academy") = " Acadeny Developers Ada"
* mystery6("Hi, there!") = " there! Hi,"