+ 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.

2nd Aug 2019, 1:59 PM
Ayesha Zareen
Ayesha Zareen - avatar
1 Antwort
+ 3
I know Scheme uses Tail recursion to implement all looping. this eliminates a lot of unnecessary stack frame generation of regular recursion
3rd Aug 2019, 10:47 PM
Rick Shiffman
Rick Shiffman - avatar