This category is for logical grouping only. It needn’t to be added directly. Instead, the sub-categories should be added.

## Least Common Ancestor of any number of nodes in Binary Tree

Given a binary tree (not a binary search tree) and any number of Key Nodes, the task is to find the least common ancestor of… Read More »

## Maximum subsequence sum with adjacent elements having atleast K difference in index

Given an array arr[] consisting of integers of length N and an integer K (1 ≤ k ≤ N), the task is to find the… Read More »

## Divide array in two Subsets such that sum of square of sum of both subsets is maximum

Given an integer array arr[], the task is to divide this array into two non-empty subsets such that the sum of the square of the… Read More »

## Find sum of f(s) for all the chosen sets from the given array

Given an array arr[] of size N and an integer K. The task is to find the sum of f(S) over all the possible sets.… Read More »

## Build a segment tree for N-ary rooted tree

Prerequisite: Segment tree and depth first search. In this article, an approach to convert an N-ary rooted tree( a tree with more than 2 children)… Read More »

## Random Tree Generator Using Prüfer Sequence with Examples

Given an integer N, the task is to generate a random labelled tree of N node with (N – 1) edges without forming cycle. Note:… Read More »

## Find minimum number of steps to reach the end of String

Given a binary string str of length N and an integer K, the task is to find the minimum number of steps required to move… Read More »

## Traveling Salesman Problem using Genetic Algorithm

Prerequisites: Genetic Algorithm, Travelling Salesman Problem In this article, a genetic algorithm is proposed to solve the travelling salesman problem. Genetic algorithms are heuristic search… Read More »

## Maximal Clique Problem | Recursive Solution

Given a small graph with N nodes and E edges, the task is to find the maximum clique in the given graph. A clique is… Read More »

## Program to build a DFA that checks if a string ends with “01” or “10”

DFA or Deterministic Finite Automata is a finite state machine which accepts a string(under some specific condition) if it reaches a final state, otherwise rejects… Read More »

## Find all cliques of size K in an undirected graph

Given an undirected graph with N nodes and E edges and a value K, the task is to print all set of nodes which form… Read More »

## Bitwise OR( | ) of all even number from 1 to N

Given a number N, the task is to find the bitwise OR( | ) of all even number from 1 to N. Examples: Input: 2… Read More »