Friday, 2 September 2016

Recursion Question set

Recursion 

Data Structures 15CS33


1.      What is recursion? Give two conditions to be followed for successive working of recursive program. Write a 'c' recursive program to solve tower of Hanoi problem.
(December 2007)
(December 2009)
(December 2010)
(June 2013)
(December 2014)
(December 2015)
(8 marks)

2.      Write a recursive function for computing nth Fibonacci term of a Fibonacci sequence. Hence give the trace of stack contents for n=4.
(June 2009)
(10 marks)

3.      Write a recursive function to find the GCD of two integers
(December 2009)
(6 marks)

4.      Determine what the following recursive C function computes
int func(int n)
{
            if(n==0)
                        return 0;
            return (n+func(n-1));
}
Write an iterative function to accomplish the same.
(June 2010)
(5 marks)

5.      Write a recursive function fact(n) to find the factorial of an integer. Diagrammatically explain how the stacking and unstacking taking place during execution for fact(4)
(June 2010)
(10 marks)

6.      Write recursion function to find the maximum of n numbers.
(December 2010)
(8 marks)

7.      Write recursion function to reverse the positive integer number.
(June 2011)
(4 marks)

8.      Write a recursive function to implement a binary search.
(December 2011)
(December 2015)
(08 marks)

9.      Write a recursive function to sum a list of numbers.
(June 2015)


No comments:

Post a Comment