## Backtracking | Introduction

Prerequisites : Recursion Complexity Analysis Backtracking is an algorithmic-technique for solving problems recursively by trying to build a solution incrementally, one piece at a time,… Read More »

Prerequisites : Recursion Complexity Analysis Backtracking is an algorithmic-technique for solving problems recursively by trying to build a solution incrementally, one piece at a time,… Read More »

If we take a look at this problem carefully, we can see that the idea of “loop” is to track some counter value e.g. “i=0”… Read More »

Given a function gcd(a, b) to find GCD (Greatest Common Divisor) of two number. It is also known that GCD of three elements can be… Read More »

Given a number num as a string and a number N. The task is to write a program which converts the given number num to… Read More »

Given a binary tree, print the level order traversal in such a way that first two levels are printed from left to right, next two… Read More »

What is Calkin Wilf Sequence? A Calkin-Wilf tree (or sequence) is a special binary tree which is obtained by starting with the fraction 1/1 and… Read More »

Most of the Dynamic Programming problems are solved in two ways: Tabulation: Bottom Up Memoization: Top Down One of the easier approaches to solve most… Read More »

Given a binary tree, flatten it into linked list in-place. Usage of auxiliary data structure is not allowed. After flattening, left of each node should… Read More »

Given an array of N elements and an integer K, print all the distinct integers which can be formed by choosing K numbers from the… Read More »

Given two strings str1 and str2, the task is to count the number of times “str2” occurs in “str1” using recursion. Examples: Input : str1… Read More »

Given a Binary tree and a number N, write a program to find the N-th node in the Postorder traversal of the given Binary tree.… Read More »

Given a binary tree, change the value in each node to sum of all the values in the nodes in the right subtree including its… Read More »

Given a set represented as string, write a recursive code to print all subsets of it. The subsets can be printed in any order. Examples:… Read More »

Given an expression string exp, write a program to examine whether the pairs and the orders of “{“, ”}”, ”(“, ”)”, ”[“, ”]” are correct… Read More »

Given a Binary Search Tree and a number N, the task is to find the smallest number in the binary search tree that is greater… Read More »