Question: If we write a recursive function and find that it's slow, but then we speed it up using tail recursion, what changed to make it

If we write a recursive function and find that it's slow, but then we speed
it up using tail recursion, what changed to make it go faster?
A: It's avoiding doing redundant work multiple times by remembering
intermediate results.
B: The compiler rewrote the program with a loop, so it's now roughly as fast
as using iteration.
C: We were doing two recursive calls before, which caused an exponential
slowdown -- now we're only doing one recursive call.
D: Now our variables are allocated on the heap, which makes the program go
faster.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!