Recursion Questions (Small Input Technique)
Numbers
• Print numbers from 1 to N
• Print numbers from N to 1
• Sum of first N numbers
• Factorial of N
• Fibonacci series (nth term & printing first N terms)
• Power function (x^n)
• GCD (Euclidean algorithm)
• Count digits of a number
• Sum of digits of a number
• Reverse a number
Arrays
• Print all elements of an array
• Print elements in reverse order
• Find maximum element in array
• Find minimum element in array
• Sum of elements in array
• Linear search using recursion
• Binary search using recursion
• Check if an array is sorted
• Count frequency of an element
Strings
• Print characters of a string
• Print reverse of a string
• Length of string (without using strlen)
• Count vowels in a string
• Check if string is palindrome
• Compare two strings (like strcmp)
• Remove all occurrences of a character
• Replace all occurrences of a character
Mathematical Series / Patterns
• Print AP series (2, 4, 6, …)
• Print GP series (2, 4, 8, …)
• Print sum of AP/GP series
• Print stars in a line (***** )
• Print triangle of stars using recursion
2D Arrays (Matrix)
• Print matrix elements row-wise recursively
• Print matrix elements column-wise recursively
• Find sum of matrix elements recursively
• Find maximum element in matrix recursively
• Search an element in matrix recursively
Stack
• Print elements of stack (without modifying it)
• Print elements in reverse order (without modifying it)
• Sum of all elements in stack
• Find maximum element in stack
• Count elements in stack
Linked List
• Print linked list elements
• Print linked list elements in reverse
• Count number of nodes in linked list
• Find sum of linked list nodes
• Find maximum element in linked list
• Search an element in linked list
• Reverse a linked list (using recursion)
• Compare two linked lists element by element