3 ms·
No. The very last instruction of tail recursion (on the recursive branch, not the base case of course) should be directly returning the return value of the recu
by DrJokepu 16y ago
No. The very last instruction of tail recursion (on the recursive branch, not the base case of course) should be directly returning the return value of the recursively called function. Otherwise, you cannot overwrite the stack frame (in other words, you need to remember the values of temporary variables of previous iterations).