Category Archives: Backtracking

Given an N-ary Tree rooted at 1, and an array val[] consisting of weights assigned to every node, and a matrix Q[][], consisting of queries… Read More
The N Queen is the problem of placing N chess queens on an N×N chessboard so that no two queens attack each other. For example, the… 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 matrix board[][] consisting of the characters K or k, Q or q, B or b, N or n, R or r, and P… Read More
Given a numeric string S representing a large number, the task is to form a Fibonacci Sequence of at least length 3 from the given… Read More
Given a weighted, directed graph G, an array V[] consisting of vertices, the task is to find the Minimum Cost Path passing through all the… Read More
Given an integer X, the task is to convert 1 into X by using the below-given operations:  Multiply the number by 2. Multiply the number… Read More
Given an undirected graph defined by the number of vertex V and the edges E[ ], the task is to find Maximal Independent Vertex Set… Read More
Given an undirected graph with V vertices and E edges, the task is to print all the independent sets and also find the maximal independent… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to find the length of the longest subsequence with a… Read More
Given an array arr[] of size N, the task is to find the number of times the array can be partitioned repetitively into two subarrays… Read More
Given an array arr[] of N integers and two numbers K and S, the task is to print all the subsquence of length K with… Read More
Given an integer S and an array arr[], the task is to find the minimum number of elements whose sum is S, such that any… Read More
Algorithms are the methodical sequence of steps which are defined to solve complex problems. In this article, we will see the difference between two such… Read More
Given a graph with N nodes and E edges, the task is to count the number of clique having their size as a prime number… Read More