+ 4
Recursion vs. Tail Recursion vs. Loop
Suppose you are working for a software company having a system with limited memory and you have been given a task. You are using a recursive function to complete the task but you realize that you can use tail recursion instead of a recursive function and then you realize that this tail recursion can be converted to loop. Now the question is that which of the following technique is best for the above-given scenario and why? 1. Recursive Function. 2. Tail Recursion. 3. Loop.
1 Odpowiedź
+ 3
I know Scheme uses Tail recursion to implement all looping. this eliminates a lot of unnecessary stack frame generation of regular recursion