diff --git a/recursion-tracing.md b/recursion-tracing.md new file mode 100644 index 0000000..e56a32e --- /dev/null +++ b/recursion-tracing.md @@ -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,"