Skip to content

# Tag Archives: Algorithms-Recursion

Given a Directed Acyclic Graph with V vertices and E edges, the task is to find the set of dominant vertices for each vertex of… Read More
Given an array arr[] consisting of N integers, the task is to sort the given array in ascending order using the slow sort. Examples: Input:… Read More
Give an integer N, the task is to find the minimum number of moves to reduce N to 0 by one of the following operations:… Read More
Given an integer N, the task is to print all the possible ways in which N can be written as the sum of two or… Read More
Given a number in form of string str and an integer K, the task is to find the smallest integer that can be formed after… Read More
Given a Binary Tree, the task is to print the nodes that have grandchildren. Examples:  Input:   Output: 20 8 Explanation: 20 and 8 are the grandparents of… Read More
Given an array arr[] of N positive integers and two positive integers S and K, the task is to reach the position of the array… Read More
Given two strings S and T and a number K, the task is to count the number of ways to convert string S to string… Read More
Given N blocks, out of which K is colored. These K-colored blocks are denoted by an array arr[]. The task is to count the number… Read More
Given a number N, the task is to print all the factors of N using recursion.Examples:   Input: N = 16 Output: 1 2 4 8 16 Explanation: 1,… Read More
Given a binary tree where node values are lowercase alphabets, the task is to find the lexicographically smallest diameter. Diameter is the longest path between… Read More
Given a binary tree, the task is to find the bottom view of a binary tree using recursion. Examples: Input: 1 \ 2 \ 4… Read More
Given five integers i, Fi, j, Fj and N. Where Fi and Fj are the ith and jth term of a sequence which follows the… Read More
What is Recursion? The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive… Read More
Given an integer N > 0, the task is to find the maximum product of digits among numbers less than or equal to N.Examples:   Input:… Read More