Question: A recursive method is said to be tail recursive if there are no pending operations to be performed on return from a recursive call. Here
A recursive method is said to be tail recursive if there are no pending operations to be performed on return from a recursive call. Here is the fib method from Lecture 1: public static long fib(long index) ( // assume index0 if (index0) //Base case return 0 else if (index1) // Base case return 1; else // Reduction and recursive calls return fib (index 1) + fib(index 2) ) 11 end of method fib(long index) Is this function tail recursive? If not, rewrite this function into an equivalent one which is tail recursive
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
