Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 4 Online
OpenStudy (anonymous):

I'm trying to understand what is going on while the function factR on page 45 of the textbook executes. I can look at it and tell intuitively that it works, but I like to understand what is happening within the computer. The way I tried to represent it to myself is by drawing a stack. Wondering if anyone can tell me if I'm on the right track with this. It seems to me that you execute factR for each value of n. For example, if you want to calculate the factorial of 4, factR executes for n = 4, n = 3, n = 2, and n = 1. I'll insert a drawing to show what I think is happening.

OpenStudy (anonymous):

Below is a sketch of what in my mind is happening. |dw:1451758076401:dw|

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!