Recursion problems to practise
For solving recursion one should I understand how to solve these problems in the following order.
1. Fibonacci series with recursion.
2. Factorial of a number.
3. Handshakes in a room
4. Towers of hanoi
5. Binary Search
6. Quick sort with Recursion
7. Given an array of integers, print sums of all subsets in it. Output sums can be printed in any order.
Input : arr[] = {2, 3}
Output: 0 2 3 5
Input : arr[] = {2, 4, 5} Output : 0 2 4 5 6 7 9 11
8. Generate all binary strings without consecutive 1’s. Given an integer K. Task is Print All binary string of size K (Given number).
Examples:
Input : K = 3
Output : 000 , 001 , 010 , 100 , 101
Input : K = 4
Output :0000 0001 0010 0100 0101 1000 1001 1010
Comments
Post a Comment