Some Questions on Recursion

1)Given a number n, find the nth Fibinocci number.

2)Using recursion,reverse a given string.

3)Find the factorial of a given number.

4)Towers of Hanoi: The towers of hanoi problem consists of a set of three poles arranged in a row. There is a set of n disks of decreasing size stacked on one of the poles. The problem is to transfer these disks from the current pole to another by moving only one disk at a time, subject to the constraint that you cannot place a disk on top of a smaller one. Write a program to compute the sequence of moves that will accomplish the task.

5)Find the gcd of 2 numbers using recursion.

6)Given a string, find all the permutations of that string.

7)Given a string and a number x(<=length of that string).Find all the combinations of that string with x characters.

8)Implement a merge sort and quick sort.

Click here for the solutions>

No comments:

Post a Comment