Recursive Practice Problems with Solutions
Basics –
Strings –
- Given a string, print all possible palindromic partitions
- Check if a number is Palindrome
- Print all possible strings of length k that can be formed from a set of n characters
- Recursive Implementation of atoi()
- Find all even length binary sequences with same sum of first and second half bits
- Print all possible expressions that evaluate to a target
- String with additive sequence
- Generate all binary strings without consecutive 1’s
- Recursive solution to count substrings with same first and last characters
- All possible binary numbers of length n with equal sum in both halves
- Combinations in a String of Digits
- Count consonants in a string (Iterative and recursive methods)
- Program for length of a string using recursion
- First uppercase letter in a string (Iterative and Recursive)
- Partition given string in such manner that i’th substring is sum of (i-1)’th and (i-2)’th substring
- Power Set in Lexicographic order
- Function to copy string (Iterative and Recursive)
Array –
- Print all possible combinations of r elements in a given array of size n
- Print all increasing sequences of length k from first n natural numbers
- Generate all possible sorted arrays from alternate elements of two given sorted arrays
- Program to find the minimum (or maximum) element of an array
- Sum triangle from array
Stack –
Linked List –
- Recursive function to delete k-th node from linked list
- Recursive insertion and traversal linked list
- Reverse a Doubly linked list using recursion
- Delete a linked list using recursion
- Print alternate nodes of a linked list using recursion
- Recursive approach for alternating split of Linked List
- Find middle of singly linked list Recursively
- Practice questions for Linked List and Recursion
Binary Tree –
- Print all leaf nodes of a Binary Tree from left to right
- Leaf nodes from Preorder of a Binary Search Tree (Using Recursion)
Dynamic Programming –
- Print all longest common sub-sequences in lexicographical order
- Recursive Tower of Hanoi using 4 pegs / rods
- Time Complexity Analysis | Tower Of Hanoi (Recursion)
Sorting –
Mathematical –
- Print a pattern without using any loop
- Print all non-increasing sequences of sum equal to a given number x
- Print all n-digit strictly increasing numbers
- Print sums of all subsets of a given set
- Find ways an Integer can be expressed as sum of n-th power of unique natural numbers
- Recaman’s sequence
- 1 to n bit numbers with no consecutive 1s in binary representation
- Program for Sum the digits of a given number
- Count ways to express a number as sum of powers
- Find m-th summation of first n natural numbers
- Print N-bit binary numbers having more 1’s than 0’s in all prefixes
- Generate all passwords from given character set
- Minimum tiles of sizes in powers of two to cover whole area
- Alexander Bogomolny’s UnOrdered Permutation Algorithm
- Sum of natural numbers using recursion
- Decimal to binary number using recursion
- Sum of digit of a number using recursion
- Binary to Gray code using recursion
- Number of non-negative integral solutions of sum equation
- Product of 2 Numbers using Recursion
- Print all combinations of factors (Ways to factorize)
- Recursive program for prime number
Programming Puzzles –
Misc –
- Mutual Recursion with example of Hofstadter Female and Male sequences
- Check if a destination is reachable from source with two movements allowed
- Minimum steps to reach a destination
- Identify all Grand-Parent Nodes of each Node in a Map
- C++ program to implement Collatz Conjecture
- Practice Questions for Recursion | Set 1
- Practice Questions for Recursion | Set 2
- Practice Questions for Recursion | Set 3
- Practice Questions for Recursion | Set 4
- Practice Questions for Recursion | Set 5
- Practice Questions for Recursion | Set 6
- Practice Questions for Recursion | Set 7
Please Login to comment...