## Magical Indices in an array

Given an array A of integers. Index i of A is said to be connected to index j if j = (i + A[i]) %… Read More »

Given an array A of integers. Index i of A is said to be connected to index j if j = (i + A[i]) %… Read More »

A graph is a data structure that is defined by two components : A node or a vertex. An edge E or ordered pair is… Read More »

Given an undirected and connected graph and a number n, count total number of cycles of length n in the graph. A cycle of length… Read More »

We are given a directed graph. We need compute whether the graph has negative cycle or not. A negative cycle is one in which the… Read More »

Given a weighted and undirected graph, we need to find if a cycle exist in this graph such that the sum of weights of all… Read More »

Given a graph, the task is to find if it has a cycle of odd length or not. Recommended: Please try your approach on {IDE}… Read More »

A directed acyclic graph (DAG) is a graph which doesn’t contain a cycle and has directed edges. We are given a DAG, we need to… Read More »

Given a directed and strongly connected graph with non negative edge weighs. We define mean weight of a cycle as the summation of all the… Read More »

Given positive weighted undirected graph, find minimum weight cycle in it. Examples: Minimum weighted cycle is : Minimum weighed cycle : 7 + 1 +… Read More »

Given a directed graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least… Read More »

Given a graph with both directed and undirected edges. It is given that the directed edges don’t form cycle. How to assign directions to undirected… Read More »

Write a function that returns true if a given undirected graph is tree and false otherwise. For example, the following graph is a tree. But… Read More »

Eulerian Path is a path in graph that visits every edge exactly once. Eulerian Circuit is an Eulerian Path which starts and ends on the… Read More »

. Given an undirected graph, how to check if there is a cycle in the graph? For example, the following graph has a cycle 1-0-2-1.… Read More »