末尾再帰の例を見つけようとしましたが、通常の再帰と末尾の違いが本当にわかりません。これが末尾再帰でない場合、誰かが理由を教えてもらえますか?
public static long fib(long index) {
// assume index >= 0
if (index == 0) // Base case
return 0;
else
if (index == 1) // Base case
return 1;
else
// Reduction and recursive calls
return fib(index - 1) + fib(index - 2);
} // end of method fib(long index)