## Maximum number of multiples in an array before any element

Given an array arr[], the task is to find the maximum number of indices j < i such that (arr[j] % arr[i]) = 0 among… Read More »

## Print all possible combinations of words from Dictionary using Trie

Given an array of strings arr[], for every string in the array, print all possible combinations of strings that can be concatenated to make that… Read More »

## Find three prime numbers with given sum

Given an integer N, the task is to find three prime numbers X, Y and Z such that the sum of these three numbers is… Read More »

## Efficiently merging two sorted arrays with O(1) extra space and O(NlogN + MlogM)

Given two sorted arrays arr1[] and arr2[], the task is to merge them in O(Nlog(N) + Mlog(M)) time with O(1) extra space into a sorted… Read More »

## 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 »

## Pareto Optimality and its application in Game Theory

Prerequisites: Game Theory When the strategies from game theory are discussed, they are often mentioned from a player’s perspective. However, when the strategies are formed… 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 »